mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-03 04:13:31 +00:00
parse a module's files into a vector ( conditions are still a TODO )
svn path=/branches/xmlbuildsystem/; revision=12789
This commit is contained in:
@@ -17,3 +17,34 @@ Module::Module ( const XMLElement& moduleNode,
|
||||
path(modulePath)
|
||||
{
|
||||
}
|
||||
|
||||
Module::~Module()
|
||||
{
|
||||
for ( size_t i = 0; i < files.size(); i++ )
|
||||
delete files[i];
|
||||
}
|
||||
|
||||
void
|
||||
Module::ProcessXML ( const XMLElement& e, const string& path )
|
||||
{
|
||||
string subpath ( path );
|
||||
if ( e.name == "file" && e.value.size() )
|
||||
{
|
||||
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++ )
|
||||
ProcessXML ( *e.subElements[i], subpath );
|
||||
}
|
||||
|
||||
File::File ( const std::string& _name )
|
||||
: name(_name)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -552,10 +552,12 @@ Project::ProcessXML ( const XMLElement& e, const string& path )
|
||||
return;
|
||||
Module* module = new Module ( e, att->value, path );
|
||||
modules.push_back ( module );
|
||||
return; // REM TODO FIXME no processing of modules... yet
|
||||
module->ProcessXML ( e, path );
|
||||
return;
|
||||
}
|
||||
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;
|
||||
@@ -611,6 +613,25 @@ main ( int argc, char** argv )
|
||||
printf ( "\t%s in folder: %s\n",
|
||||
m.name.c_str(),
|
||||
m.path.c_str() );
|
||||
printf ( "\txml dependencies:\n\t\tReactOS.xml\n" );
|
||||
const XMLElement* e = &m.node;
|
||||
while ( e )
|
||||
{
|
||||
if ( e->name == "xi:include" )
|
||||
{
|
||||
const XMLAttribute* att = e->GetAttribute("top_href",false);
|
||||
if ( att )
|
||||
{
|
||||
printf ( "\t\t%s\n", att->value.c_str() );
|
||||
}
|
||||
}
|
||||
e = e->parentElement;
|
||||
}
|
||||
printf ( "\tfiles:\n" );
|
||||
for ( size_t j = 0; j < m.files.size(); j++ )
|
||||
{
|
||||
printf ( "\t\t%s\n", m.files[j]->name.c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
delete proj;
|
||||
|
||||
@@ -72,6 +72,7 @@ public:
|
||||
|
||||
class Project;
|
||||
class Module;
|
||||
class File;
|
||||
|
||||
class Project
|
||||
{
|
||||
@@ -89,10 +90,23 @@ public:
|
||||
const XMLElement& node;
|
||||
std::string name;
|
||||
std::string path;
|
||||
std::vector<File*> files;
|
||||
|
||||
Module ( const XMLElement& moduleNode,
|
||||
const std::string& moduleName,
|
||||
const std::string& modulePath );
|
||||
|
||||
~Module();
|
||||
|
||||
void ProcessXML ( const XMLElement& e, const std::string& path );
|
||||
};
|
||||
|
||||
class File
|
||||
{
|
||||
public:
|
||||
std::string name;
|
||||
|
||||
File ( const std::string& _name );
|
||||
};
|
||||
|
||||
#endif /* __RBUILD_H */
|
||||
|
||||
Reference in New Issue
Block a user