[ros-diffs] [mpiulachs] 30112: - beautified the credits and autocontributors.h auto-generated files - added new attribute "website" to contributors - validate developder/mantainer/translator alias

mpiulachs at svn.reactos.org mpiulachs at svn.reactos.org
Sun Nov 4 15:11:41 CET 2007


Author: mpiulachs
Date: Sun Nov  4 17:11:41 2007
New Revision: 30112

URL: http://svn.reactos.org/svn/reactos?rev=30112&view=rev
Log:
- beautified the credits and autocontributors.h auto-generated files
- added new attribute "website" to contributors
- validate developder/mantainer/translator alias

Modified:
    branches/rbuild/reactos/tools/rbuild/creditsgeneratorenerator.cpp
    branches/rbuild/reactos/tools/rbuild/module.cpp
    branches/rbuild/reactos/tools/rbuild/rbuild.h

Modified: branches/rbuild/reactos/tools/rbuild/creditsgeneratorenerator.cpp
URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/creditsgeneratorenerator.cpp?rev=30112&r1=30111&r2=30112&view=diff
==============================================================================
--- branches/rbuild/reactos/tools/rbuild/creditsgeneratorenerator.cpp (original)
+++ branches/rbuild/reactos/tools/rbuild/creditsgeneratorenerator.cpp Sun Nov  4 17:11:41 2007
@@ -55,20 +55,34 @@
     {
         Contributor& contributor = *project.contributors[i];
 
-        s = s + sprintf ( s, "\t%s %s (%s)\n" , 
-            contributor.firstName.c_str() , 
-            contributor.lastName.c_str() , 
-            contributor.alias.c_str());
-        
-        s = s + sprintf ( s, "\t\t%s\n" , contributor.mail.c_str());
-        
+        if (strlen(contributor.alias.c_str()))
+        {
+            s = s + sprintf ( s, "\t%s %s (%s)\n" , 
+                contributor.firstName.c_str() , 
+                contributor.lastName.c_str() , 
+                contributor.alias.c_str());
+        }
+        else
+        {
+            s = s + sprintf ( s, "\t%s %s\n" , 
+                contributor.firstName.c_str() , 
+                contributor.lastName.c_str());
+        }
+
+        if (strlen(contributor.mail.c_str()))
+        {
+            s = s + sprintf ( s, "\t\t%s\n" , contributor.mail.c_str());
+        }
+
         if (strlen(contributor.city.c_str()) > 0 &&
             strlen(contributor.country.c_str()) > 0)
         {
-            s = s + sprintf ( s, "\t\t%s,%s\n\n" , 
+            s = s + sprintf ( s, "\t\t%s,%s\n" , 
                 contributor.city.c_str() , 
                 contributor.country.c_str());
         }
+
+        s = s + sprintf ( s, "\n");
     }
 
 
@@ -90,7 +104,8 @@
     s = buf;
     s = s + sprintf ( s, "/* Auto generated */\n");
     s = s + sprintf ( s, "\n" );
-    s = s + sprintf ( s, "const char* szAutoContributors[]= {\n" );
+    s = s + sprintf ( s, "const char* szAutoContributors[]= \n" );
+    s = s + sprintf ( s, "{\n" );
 
     for ( size_t i = 0; i < project.contributors.size (); i++ )
     {

Modified: branches/rbuild/reactos/tools/rbuild/module.cpp
URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/module.cpp?rev=30112&r1=30111&r2=30112&view=diff
==============================================================================
--- branches/rbuild/reactos/tools/rbuild/module.cpp (original)
+++ branches/rbuild/reactos/tools/rbuild/module.cpp Sun Nov  4 17:11:41 2007
@@ -309,57 +309,7 @@
 	}
 	else
 		isUnicode = false;
-/*
-	att = moduleNode.GetAttribute ( "generatemanifest", false );
-	if ( att != NULL )
-	{
-		const char* p = att->value.c_str();
-		if ( !stricmp ( p, TRUE_STRING ) || !stricmp ( p, YES_STRING ) )
-			generateManifestFile = true;
-		else if ( !stricmp ( p, FALSE_STRING ) || !stricmp ( p, NO_STRING ) )
-			generateManifestFile = false;
-		else
-		{
-			throw InvalidAttributeValueException (
-				moduleNode.location,
-				"generatemanifest",
-				att->value );
-		}
-	}
-	else
-		generateManifestFile = false;
-
-	att = moduleNode.GetAttribute ( "generateresource", false );
-	if ( att != NULL )
-	{
-		const char* p = att->value.c_str();
-		if ( !stricmp ( p, TRUE_STRING ) || !stricmp ( p, YES_STRING ) )
-		{
-			generateResourceFile = true;
-
-			File* resFile = new File ( IntermediateDirectory,
-									 output->relative_path,
-									 "auto.rc",
-									 false,
-									 "",
-									 false );
-
-			non_if_data.files.push_back ( resFile );
-
-		}
-		else if ( !stricmp ( p, FALSE_STRING ) || !stricmp ( p, NO_STRING ) )
-			generateResourceFile = false;
-		else
-		{
-			throw InvalidAttributeValueException (
-				moduleNode.location,
-				"generateResourceFile",
-				att->value );
-		}
-	}
-	else
-		generateResourceFile = false;
-*/
+
 	if (isUnicode)
 	{
 		// Always define UNICODE and _UNICODE
@@ -957,24 +907,19 @@
 		}
 		subs_invalid = true;
 	}
-	else if ( e.name == "developer" )
-	{
-		authors.push_back ( new Author ( e, *this , Developer) );
+	else if ( e.name == "developer" && e.value.size ())
+	{
+        authors.push_back ( new Author ( e, *this , Developer, e.value) );
 		subs_invalid = true;
 	}
-	else if ( e.name == "mantainer" )
-	{
-		authors.push_back ( new Author ( e, *this , Mantainer ) );
+	else if ( e.name == "mantainer" && e.value.size ())
+	{
+		authors.push_back ( new Author ( e, *this , Mantainer, e.value ) );
 		subs_invalid = true;
 	}
-	//else if ( e.name == "contributor" )
-	//{
-	//	authors.push_back ( new Author ( e, *this , Contributor ) );
-	//	subs_invalid = false;
-	//}
-	else if ( e.name == "translator" )
-	{
-		authors.push_back ( new Author ( e, *this , Translator ) );
+	else if ( e.name == "translator" && e.value.size ())
+	{
+		authors.push_back ( new Author ( e, *this , Translator, e.value ) );
 		subs_invalid = true;
 	}
 	else if ( e.name == "component" )
@@ -1744,47 +1689,31 @@
 		country = att->value;
 	else
 		country = "";
-}
-
-/*
-AuthorRole
-Author::GetAuthorRole ( const string& location, const XMLAttribute& attribute )
-{
-	if ( attribute.value == "developer" )
-		return Developer;
-	if ( attribute.value == "mantainer" )
-		return Mantainer;
-	if ( attribute.value == "contributor" )
-		return Contributor;
-	if ( attribute.value == "translator" )
-		return Translator;
-	throw InvalidAttributeValueException ( location,
-	                                       attribute.name,
-	                                       attribute.value );
-}
-*/
-
-Author::Author ( const XMLElement& _node , const Module& module_ , AuthorRole role_)
-	: node (_node), module(module_) , role(role_)
+
+    att = node.GetAttribute ( "website", false );
+	if (att != NULL)
+		website = att->value;
+	else
+		website = "";
+}
+
+Author::Author ( const XMLElement& _node , const Module& module_ , AuthorRole role_ , const string& alias_)
+	: node (&_node), module(module_) , role(role_) , alias (alias_)
 {
 	ProcessXML ();
 }
-
-/*
-Author::Author ( const XMLElement& _node , const Module& module_)
-	: node (_node), module(module_) , role (Developer)
-{
-	//const XMLAttribute* att = _node.GetAttribute ( "role", true );
-	//assert(att);
-	//role = GetAuthorRole(_node.location , *att);
-
-	ProcessXML ();
-}*/
 
 void
 Author::ProcessXML()
 {
-	alias = node.value;
+    if ( node && !module.project.LocateContributor ( alias ) )
+	{
+		throw XMLInvalidBuildFileException (
+			node->location,
+			"module '%s' references a non-existant contributor '%s'",
+			module.name.c_str(),
+			alias.c_str() );
+	}
 }
 
 Localization::Localization ( const XMLElement& node_,

Modified: branches/rbuild/reactos/tools/rbuild/rbuild.h
URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/rbuild.h?rev=30112&r1=30111&r2=30112&view=diff
==============================================================================
--- branches/rbuild/reactos/tools/rbuild/rbuild.h (original)
+++ branches/rbuild/reactos/tools/rbuild/rbuild.h Sun Nov  4 17:11:41 2007
@@ -667,6 +667,8 @@
     std::string mail;
     std::string city;
     std::string country;
+    std::string website;
+    bool active;
 
     Contributor ( const XMLElement& _node);
 
@@ -676,13 +678,12 @@
 class Author
 {
 public:
-	const XMLElement& node;
+	const XMLElement* node;
 	const Module& module;
+	AuthorRole role;
 	std::string alias;
-	AuthorRole role;
-
-	//Author ( const XMLElement& _node, const Module& module);
-	Author ( const XMLElement& _node, const Module& module, AuthorRole role  );
+
+	Author ( const XMLElement& _node, const Module& module, AuthorRole role , const std::string& alias);
 
 	void ProcessXML ();
 };




More information about the Ros-diffs mailing list