14 Project::Project ( const string
& filename
)
16 if ( !xmlfile
.open ( filename
) )
17 throw FileNotFoundException ( filename
);
23 for ( size_t i
= 0; i
< modules
.size (); i
++ )
35 head
= XMLParse ( xmlfile
, path
);
37 throw InvalidBuildFileException ( "Document contains no 'project' tag." );
38 } while ( head
->name
!= "project" );
40 this->ProcessXML ( *head
, "." );
44 Project::ProcessXML ( const XMLElement
& e
, const string
& path
)
46 const XMLAttribute
*att
;
48 if ( e
.name
== "project" )
50 att
= e
.GetAttribute ( "name", false );
56 att
= e
.GetAttribute ( "makefile", true );
58 makefile
= att
->value
;
60 else if ( e
.name
== "module" )
62 att
= e
.GetAttribute ( "name", true );
64 Module
* module
= new Module ( this, e
, att
->value
, path
);
65 modules
.push_back ( module
);
66 module
->ProcessXML ( e
, path
);
69 else if ( e
.name
== "directory" )
71 const XMLAttribute
* att
= e
.GetAttribute ( "name", true );
73 subpath
= path
+ CSEP
+ att
->value
;
75 for ( size_t i
= 0; i
< e
.subElements
.size (); i
++ )
76 ProcessXML ( *e
.subElements
[i
], subpath
);
80 Project::LocateModule ( string name
)
82 for ( size_t i
= 0; i
< modules
.size (); i
++ )
84 if (modules
[i
]->name
== name
)