path(modulePath)\r
{\r
}\r
+\r
+Module::~Module()\r
+{\r
+ for ( size_t i = 0; i < files.size(); i++ )\r
+ delete files[i];\r
+}\r
+\r
+void\r
+Module::ProcessXML ( const XMLElement& e, const string& path )\r
+{\r
+ string subpath ( path );\r
+ if ( e.name == "file" && e.value.size() )\r
+ {\r
+ files.push_back ( new File(path + "/" + e.value) );\r
+ }\r
+ else if ( e.name == "directory" )\r
+ {\r
+ // this code is duplicated between Project::ProcessXML() and Module::ProcessXML() :(\r
+ const XMLAttribute* att = e.GetAttribute ( "name", true );\r
+ if ( !att )\r
+ return;\r
+ subpath = path + "/" + att->value;\r
+ }\r
+ for ( size_t i = 0; i < e.subElements.size(); i++ )\r
+ ProcessXML ( *e.subElements[i], subpath );\r
+}\r
+\r
+File::File ( const std::string& _name )\r
+ : name(_name)\r
+{\r
+}\r
return;\r
Module* module = new Module ( e, att->value, path );\r
modules.push_back ( module );\r
- return; // REM TODO FIXME no processing of modules... yet\r
+ module->ProcessXML ( e, path );\r
+ return;\r
}\r
else if ( e.name == "directory" )\r
{\r
+ // this code is duplicated between Project::ProcessXML() and Module::ProcessXML() :(\r
const XMLAttribute* att = e.GetAttribute ( "name", true );\r
if ( !att )\r
return;\r
printf ( "\t%s in folder: %s\n",\r
m.name.c_str(),\r
m.path.c_str() );\r
+ printf ( "\txml dependencies:\n\t\tReactOS.xml\n" );\r
+ const XMLElement* e = &m.node;\r
+ while ( e )\r
+ {\r
+ if ( e->name == "xi:include" )\r
+ {\r
+ const XMLAttribute* att = e->GetAttribute("top_href",false);\r
+ if ( att )\r
+ {\r
+ printf ( "\t\t%s\n", att->value.c_str() );\r
+ }\r
+ }\r
+ e = e->parentElement;\r
+ }\r
+ printf ( "\tfiles:\n" );\r
+ for ( size_t j = 0; j < m.files.size(); j++ )\r
+ {\r
+ printf ( "\t\t%s\n", m.files[j]->name.c_str() );\r
+ }\r
}\r
\r
delete proj;\r
\r
class Project;\r
class Module;\r
+class File;\r
\r
class Project\r
{\r
const XMLElement& node;\r
std::string name;\r
std::string path;\r
+ std::vector<File*> files;\r
\r
Module ( const XMLElement& moduleNode,\r
const std::string& moduleName,\r
const std::string& modulePath );\r
+\r
+ ~Module();\r
+\r
+ void ProcessXML ( const XMLElement& e, const std::string& path );\r
+};\r
+\r
+class File\r
+{\r
+public:\r
+ std::string name;\r
+\r
+ File ( const std::string& _name );\r
};\r
\r
#endif /* __RBUILD_H */\r