use enum instead of string in more places Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-09 03:29:46 UTC (rev 12901) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-09 03:43:26 UTC (rev 12902) @@ -92,7 +92,7 @@
{ MingwModuleHandler* h = MingwModuleHandler::LookupHandler ( module.node.location, - module.stype ); + module.type ); h->Process ( module ); }
_____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-09 03:29:46 UTC (rev 12901) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-09 03:43:26 UTC (rev 12902) @@ -10,18 +10,16 @@
using std::vector; using std::map;
-map<string,MingwModuleHandler*>* +map<ModuleType,MingwModuleHandler*>* MingwModuleHandler::handler_map = NULL;
FILE* MingwModuleHandler::fMakefile = NULL;
-MingwModuleHandler::MingwModuleHandler ( const char* moduletype_ ) +MingwModuleHandler::MingwModuleHandler ( ModuleType moduletype ) { - string moduletype ( moduletype_ ); - strlwr ( &moduletype[0] ); if ( !handler_map ) - handler_map = new map<string,MingwModuleHandler*>; + handler_map = new map<ModuleType,MingwModuleHandler*>; (*handler_map)[moduletype] = this; }
@@ -33,10 +31,8 @@
/*static*/ MingwModuleHandler* MingwModuleHandler::LookupHandler ( const string& location, - const string& moduletype_ ) + ModuleType moduletype ) { - string moduletype ( moduletype_ ); - strlwr ( &moduletype[0] ); if ( !handler_map ) throw Exception ( "internal tool error: no registered module handlers" ); MingwModuleHandler* h = (*handler_map)[moduletype]; @@ -386,7 +382,7 @@ { const Invoke& invoke = *module.invocations[i];
- if ( invoke.invokeModule->etype != BuildTool ) + if ( invoke.invokeModule->type != BuildTool ) throw InvalidBuildFileException ( module.node.location, "Only modules of type buildtool can be invoked." );
@@ -446,7 +442,7 @@ static MingwBuildToolModuleHandler buildtool_handler;
MingwBuildToolModuleHandler::MingwBuildToolModuleHandler() - : MingwModuleHandler ( "buildtool" ) + : MingwModuleHandler ( BuildTool ) { }
@@ -477,7 +473,7 @@ static MingwKernelModuleHandler kernelmodule_handler;
MingwKernelModuleHandler::MingwKernelModuleHandler () - : MingwModuleHandler ( "kernelmodedll" ) + : MingwModuleHandler ( KernelModeDLL ) { }
@@ -539,7 +535,7 @@ static MingwStaticLibraryModuleHandler staticlibrary_handler;
MingwStaticLibraryModuleHandler::MingwStaticLibraryModuleHandler () - : MingwModuleHandler ( "staticlibrary" ) + : MingwModuleHandler ( StaticLibrary ) { }
_____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h 2005-01-09 03:29:46 UTC (rev 12901) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h 2005-01-09 03:43:26 UTC (rev 12902) @@ -6,14 +6,14 @@
class MingwModuleHandler { public: - static std::mapstd::string,MingwModuleHandler** handler_map; + static std::map<ModuleType,MingwModuleHandler*>* handler_map;
- MingwModuleHandler ( const char* moduletype_ ); + MingwModuleHandler ( ModuleType moduletype ); virtual ~MingwModuleHandler() {}
static void SetMakefile ( FILE* f ); static MingwModuleHandler* LookupHandler ( const std::string& location, - const std::string& moduletype_ ); + ModuleType moduletype_ ); virtual void Process ( const Module& module ) = 0;
protected: _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp 2005-01-09 03:29:46 UTC (rev 12901) +++ branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp 2005-01-09 03:43:26 UTC (rev 12902) @@ -130,9 +130,9 @@
}
UnknownModuleTypeException::UnknownModuleTypeException ( const string& location, - const string& moduletype ) + int moduletype ) : InvalidBuildFileException ( location, - "module type requested: '%s'", - moduletype.c_str() ) + "module type requested: %i", + moduletype ) { } _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.h --- branches/xmlbuildsystem/reactos/tools/rbuild/exception.h 2005-01-09 03:29:46 UTC (rev 12901) +++ branches/xmlbuildsystem/reactos/tools/rbuild/exception.h 2005-01-09 03:43:26 UTC (rev 12902) @@ -98,7 +98,7 @@
{ public: UnknownModuleTypeException ( const std::string& location, - const std::string& moduletype ); + int moduletype ); };
#endif /* __EXCEPTION_H */ _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-09 03:29:46 UTC (rev 12901) +++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-09 03:43:26 UTC (rev 12902) @@ -38,9 +38,7 @@
att = moduleNode.GetAttribute ( "type", true ); assert(att); - stype = att->value; - strlwr ( &stype[0] ); - etype = GetModuleType ( node.location, *att ); + type = GetModuleType ( node.location, *att );
att = moduleNode.GetAttribute ( "extension", false ); if (att != NULL) @@ -154,7 +152,7 @@ string Module::GetDefaultModuleExtension () const { - switch (etype) + switch (type) { case BuildTool: return EXEPOSTFIX; _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h --- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-09 03:29:46 UTC (rev 12901) +++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-09 03:43:26 UTC (rev 12902) @@ -71,8 +71,7 @@
std::string name; std::string extension; std::string path; - ModuleType etype; - std::string stype; + ModuleType type; std::vector<File*> files; std::vector<Library*> libraries; std::vector<Include*> includes;