mirror of
https://github.com/reactos/reactos.git
synced 2025-07-25 12:54:02 +00:00
use enum instead of string in more places
svn path=/branches/xmlbuildsystem/; revision=12902
This commit is contained in:
parent
03e6c98e63
commit
d16f78506a
7 changed files with 19 additions and 26 deletions
|
@ -92,7 +92,7 @@ MingwBackend::ProcessModule ( Module& module )
|
|||
{
|
||||
MingwModuleHandler* h = MingwModuleHandler::LookupHandler (
|
||||
module.node.location,
|
||||
module.stype );
|
||||
module.type );
|
||||
h->Process ( module );
|
||||
}
|
||||
|
||||
|
|
|
@ -10,18 +10,16 @@ using std::string;
|
|||
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 @@ MingwModuleHandler::SetMakefile ( FILE* f )
|
|||
|
||||
/*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 @@ MingwModuleHandler::GenerateInvocations ( const Module& module ) const
|
|||
{
|
||||
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 @@ MingwModuleHandler::GeneratePreconditionDependencies ( const Module& module ) co
|
|||
static MingwBuildToolModuleHandler buildtool_handler;
|
||||
|
||||
MingwBuildToolModuleHandler::MingwBuildToolModuleHandler()
|
||||
: MingwModuleHandler ( "buildtool" )
|
||||
: MingwModuleHandler ( BuildTool )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -477,7 +473,7 @@ MingwBuildToolModuleHandler::GenerateBuildToolModuleTarget ( const Module& modul
|
|||
static MingwKernelModuleHandler kernelmodule_handler;
|
||||
|
||||
MingwKernelModuleHandler::MingwKernelModuleHandler ()
|
||||
: MingwModuleHandler ( "kernelmodedll" )
|
||||
: MingwModuleHandler ( KernelModeDLL )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -539,7 +535,7 @@ MingwKernelModuleHandler::GenerateKernelModuleTarget ( const Module& module )
|
|||
static MingwStaticLibraryModuleHandler staticlibrary_handler;
|
||||
|
||||
MingwStaticLibraryModuleHandler::MingwStaticLibraryModuleHandler ()
|
||||
: MingwModuleHandler ( "staticlibrary" )
|
||||
: MingwModuleHandler ( StaticLibrary )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
class MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
static std::map<std::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:
|
||||
|
|
|
@ -130,9 +130,9 @@ UnknownBackendException::UnknownBackendException ( const string& name )
|
|||
}
|
||||
|
||||
UnknownModuleTypeException::UnknownModuleTypeException ( const string& location,
|
||||
const string& moduletype )
|
||||
int moduletype )
|
||||
: InvalidBuildFileException ( location,
|
||||
"module type requested: '%s'",
|
||||
moduletype.c_str() )
|
||||
"module type requested: %i",
|
||||
moduletype )
|
||||
{
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ class UnknownModuleTypeException : public InvalidBuildFileException
|
|||
{
|
||||
public:
|
||||
UnknownModuleTypeException ( const std::string& location,
|
||||
const std::string& moduletype );
|
||||
int moduletype );
|
||||
};
|
||||
|
||||
#endif /* __EXCEPTION_H */
|
||||
|
|
|
@ -38,9 +38,7 @@ Module::Module ( const Project& project,
|
|||
|
||||
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 @@ Module::GetModuleType ( const string& location, const XMLAttribute& attribute )
|
|||
string
|
||||
Module::GetDefaultModuleExtension () const
|
||||
{
|
||||
switch (etype)
|
||||
switch (type)
|
||||
{
|
||||
case BuildTool:
|
||||
return EXEPOSTFIX;
|
||||
|
|
|
@ -71,8 +71,7 @@ public:
|
|||
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue