Don't pass objects ( particularly vectors ) by value unless absolutely necessary...
[reactos.git] / reactos / tools / rbuild / rbuild.h
1 #ifndef __RBUILD_H
2 #define __RBUILD_H
3
4 #include "pch.h"
5
6 #include "ssprintf.h"
7 #include "exception.h"
8 #include "XML.h"
9
10 #ifdef WIN32
11 #define EXEPOSTFIX ".exe"
12 #define CSEP '\\'
13 #define CBAD_SEP '/'
14 #define SSEP "\\"
15 #define SBAD_SEP "/"
16 #else
17 #define EXEPOSTFIX
18 #define CSEP '/'
19 #define CBAD_SEP '\\'
20 #define SSEP "/"
21 #define SBAD_SEP "\\"
22 #endif
23
24 class Project;
25 class Module;
26 class Include;
27 class Define;
28 class File;
29 class Library;
30
31 class Project
32 {
33 public:
34 std::string name;
35 std::string makefile;
36 std::vector<Module*> modules;
37 std::vector<Include*> includes;
38 std::vector<Define*> defines;
39
40 Project ();
41 Project ( const std::string& filename );
42 ~Project ();
43 void ProcessXML ( const XMLElement& e,
44 const std::string& path );
45 Module* LocateModule ( std::string name );
46 private:
47 void ReadXml ();
48 XMLFile xmlfile;
49 XMLElement* head;
50 };
51
52
53 enum ModuleType
54 {
55 BuildTool,
56 StaticLibrary,
57 KernelModeDLL
58 };
59
60
61 class Module
62 {
63 public:
64 Project* project;
65 const XMLElement& node;
66 std::string name;
67 std::string extension;
68 std::string path;
69 ModuleType type;
70 std::vector<File*> files;
71 std::vector<Library*> libraries;
72 std::vector<Include*> includes;
73 std::vector<Define*> defines;
74
75 Module ( Project* project,
76 const XMLElement& moduleNode,
77 const std::string& modulePath );
78 ~Module ();
79 ModuleType GetModuleType (const XMLAttribute& attribute );
80 std::string GetPath () const;
81 void ProcessXML ( const XMLElement& e, const std::string& path );
82 private:
83 std::string GetDefaultModuleExtension ();
84 };
85
86
87 class Include
88 {
89 public:
90 Project* project;
91 Module* module;
92 const XMLElement& node;
93 std::string directory;
94
95 Include ( Project* project,
96 const XMLElement& includeNode );
97 Include ( Project* project,
98 Module* module,
99 const XMLElement& includeNode );
100 ~Include ();
101 void ProcessXML ( const XMLElement& e );
102 private:
103 void Initialize ( const XMLElement& includeNode );
104 };
105
106
107 class Define
108 {
109 public:
110 Project* project;
111 Module* module;
112 const XMLElement& node;
113 std::string name;
114 std::string value;
115
116 Define ( Project* project,
117 const XMLElement& defineNode );
118 Define ( Project* project,
119 Module* module,
120 const XMLElement& defineNode );
121 ~Define();
122 void ProcessXML ( const XMLElement& e );
123 private:
124 void Initialize ( const XMLElement& defineNode );
125 };
126
127
128 class File
129 {
130 public:
131 std::string name;
132
133 File ( const std::string& _name );
134 };
135
136
137 class Library
138 {
139 public:
140 std::string name;
141
142 Library ( const std::string& _name );
143 };
144
145 extern std::string
146 FixSeparator ( const std::string& s );
147
148 #endif /* __RBUILD_H */