9381cf02e1f6dec0ec0847699269ba4228a0d079
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
++ )
33 head
= XMLParse ( xmlfile
, path
);
35 throw InvalidBuildFileException ( "Document contains no 'project' tag." );
37 if ( head
->name
!= "project" )
39 throw InvalidBuildFileException ( "Expected 'project', got '%s'.",
43 this->ProcessXML ( *head
, "." );
47 Project::ProcessXML ( const XMLElement
& e
, const string
& path
)
49 const XMLAttribute
*att
;
51 if ( e
.name
== "project" )
53 att
= e
.GetAttribute ( "name", false );
59 att
= e
.GetAttribute ( "makefile", true );
61 makefile
= att
->value
;
63 else if ( e
.name
== "module" )
65 att
= e
.GetAttribute ( "name", true );
67 Module
* module
= new Module ( this, e
, att
->value
, path
);
68 modules
.push_back ( module
);
69 module
->ProcessXML ( e
, path
);
72 else if ( e
.name
== "directory" )
74 const XMLAttribute
* att
= e
.GetAttribute ( "name", true );
76 subpath
= path
+ "/" + att
->value
;
78 for ( size_t i
= 0; i
< e
.subElements
.size (); i
++ )
79 ProcessXML ( *e
.subElements
[i
], subpath
);
83 Project::LocateModule ( string name
)
85 for ( size_t i
= 0; i
< modules
.size (); i
++ )
87 if (modules
[i
]->name
== name
)