Parse module type.

svn path=/branches/xmlbuildsystem/; revision=12839
This commit is contained in:
Casper Hornstrup 2005-01-05 21:29:54 +00:00
parent 1568981925
commit 91d97cbc91
6 changed files with 45 additions and 11 deletions

View file

@ -14,35 +14,43 @@ Module::Module ( const XMLElement& moduleNode,
name(moduleName),
path(modulePath)
{
type = GetModuleType ( *moduleNode.GetAttribute ( "type", true ) );
}
Module::~Module()
Module::~Module ()
{
for ( size_t i = 0; i < files.size(); i++ )
delete files[i];
}
void
Module::ProcessXML ( const XMLElement& e, const string& path )
void Module::ProcessXML ( const XMLElement& e,
const string& path )
{
string subpath ( path );
if ( e.name == "file" && e.value.size() )
if ( e.name == "file" && e.value.size () )
{
files.push_back ( new File(path + "/" + e.value) );
files.push_back ( new File ( path + "/" + e.value ) );
}
else if ( e.name == "directory" )
{
// this code is duplicated between Project::ProcessXML() and Module::ProcessXML() :(
const XMLAttribute* att = e.GetAttribute ( "name", true );
if ( !att )
return;
subpath = path + "/" + att->value;
}
for ( size_t i = 0; i < e.subElements.size(); i++ )
for ( size_t i = 0; i < e.subElements.size (); i++ )
ProcessXML ( *e.subElements[i], subpath );
}
File::File ( const std::string& _name )
ModuleType Module::GetModuleType ( const XMLAttribute& attribute )
{
if ( attribute.value == "buildtool" )
return BuildTool;
if ( attribute.value == "kernelmodedll" )
return KernelModeDLL;
throw InvalidAttributeValueException ( attribute.name,
attribute.value );
}
File::File ( const string& _name )
: name(_name)
{
}