|
0
|
1 |
/*
|
|
|
2 |
* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
3 |
* All rights reserved.
|
|
|
4 |
* This component and the accompanying materials are made available
|
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
|
6 |
* which accompanies this distribution, and is available
|
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
|
8 |
*
|
|
|
9 |
* Initial Contributors:
|
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
|
11 |
*
|
|
|
12 |
* Contributors:
|
|
|
13 |
*
|
|
|
14 |
* Description:
|
|
|
15 |
*
|
|
|
16 |
*/
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
#ifndef PLATFORMDATA_H
|
|
|
20 |
#define PLATFORMDATA_H
|
|
|
21 |
|
|
|
22 |
#include <xercesc/dom/DOM.hpp>
|
|
|
23 |
#include <string>
|
|
|
24 |
#include <vector>
|
|
|
25 |
#include <map>
|
|
|
26 |
|
|
|
27 |
using namespace std;
|
|
|
28 |
|
|
|
29 |
class Component;
|
|
|
30 |
class PlatformData;
|
|
|
31 |
|
|
|
32 |
typedef vector<string> IncludePaths;
|
|
|
33 |
|
|
|
34 |
#define PLATFORM_ELEMENT_COMPONENT "component"
|
|
|
35 |
#define PLATFORM_ELEMENT_HEADER "hdr"
|
|
|
36 |
#define PLATFORM_ELEMENT_PROJECT "prj"
|
|
|
37 |
#define PLATFORM_ELEMENT_SOURCE "src"
|
|
|
38 |
#define PLATFORM_ELEMENT_FILENAME "fname"
|
|
|
39 |
#define PLATFORM_ELEMENT_RELPATH "path"
|
|
|
40 |
#define PLATFORM_ELEMENT_INCLUDEPATH "incpath"
|
|
|
41 |
#define PLATFORM_ELEMENT_INCLUDE "inc"
|
|
|
42 |
#define PLATFORM_ELEMENT_FORCEDINCLUDE "finc"
|
|
|
43 |
#define PLATFORM_IGNORED_COMPONENT "excluded header list"
|
|
|
44 |
#define PLATFORM_ELEMENT_API_NAME "api"
|
|
|
45 |
/**
|
|
|
46 |
* Abstract base class for all the elements that are parsed from the
|
|
|
47 |
* platform's XML description.
|
|
|
48 |
*/
|
|
|
49 |
class ParsedElement
|
|
|
50 |
{
|
|
|
51 |
public:
|
|
|
52 |
ParsedElement();
|
|
|
53 |
virtual ~ParsedElement();
|
|
|
54 |
|
|
|
55 |
/**
|
|
|
56 |
* Initializes the element. This must be called before finalizing the element.
|
|
|
57 |
* @param node Pointer to the DOM node containing the data for the element.
|
|
|
58 |
* @param platform Pointer to the platform in which this element belongs.
|
|
|
59 |
* @return true if the initialization was successful, false otherwise.
|
|
|
60 |
*/
|
|
|
61 |
virtual bool Initialize(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* node, PlatformData* platform);
|
|
|
62 |
|
|
|
63 |
/**
|
|
|
64 |
* For debugging purposes. Prints the data of an element to standard output.
|
|
|
65 |
* @param indentSpaces Number of indentation spaces to get hierarchical print.
|
|
|
66 |
* @return string object containing the element's data.
|
|
|
67 |
*/
|
|
|
68 |
virtual string PrettyPrint(int indentSpaces = 0) const = 0;
|
|
|
69 |
|
|
|
70 |
protected:
|
|
|
71 |
|
|
|
72 |
/**
|
|
|
73 |
* Processes the attributes of an XML element.
|
|
|
74 |
* @param node Pointer to the element's DOM data.
|
|
|
75 |
*/
|
|
|
76 |
virtual void ProcessAttributes(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* node) = 0;
|
|
|
77 |
|
|
|
78 |
/**
|
|
|
79 |
* Processes the child elements of an XML element.
|
|
|
80 |
* @param node Pointer to the element's DOM data.
|
|
|
81 |
* @param platform Pointer to the platform in which this element belongs.
|
|
|
82 |
*/
|
|
|
83 |
virtual bool ProcessChildElement(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* node, PlatformData* platform) = 0;
|
|
|
84 |
|
|
|
85 |
/**
|
|
|
86 |
* Adds this element to the given platform. NOTE! When the addition
|
|
|
87 |
* is successful, the platform takes the ownership of this element.
|
|
|
88 |
* But when the addition is unsuccessful the caller must take care of
|
|
|
89 |
* the object deallocation.
|
|
|
90 |
* @param platform Pointer to the platform
|
|
|
91 |
* @return true, if the addition was successful. False otherwise.
|
|
|
92 |
*/
|
|
|
93 |
virtual bool AddToPlatform(PlatformData* platform) = 0;
|
|
|
94 |
|
|
|
95 |
// Platform's root directory. Given in application parameters (i.e BASELINEDIR or CURRENTDIR).
|
|
|
96 |
string iRootDir;
|
|
|
97 |
};
|
|
|
98 |
|
|
|
99 |
typedef vector<ParsedElement*> ElementVector;
|
|
|
100 |
|
|
|
101 |
/**
|
|
|
102 |
* ComponentFile is a base class for files inside a component.
|
|
|
103 |
*/
|
|
|
104 |
class ComponentFile : public ParsedElement
|
|
|
105 |
{
|
|
|
106 |
public:
|
|
|
107 |
|
|
|
108 |
/**
|
|
|
109 |
* Default constructor
|
|
|
110 |
*/
|
|
|
111 |
ComponentFile();
|
|
|
112 |
|
|
|
113 |
/**
|
|
|
114 |
* Constructor
|
|
|
115 |
* @param ID Unique file id.
|
|
|
116 |
* @param comp Pointer to the <code>Component</code> in which this file belongs.
|
|
|
117 |
*/
|
|
|
118 |
ComponentFile(const string& ID, Component* comp);
|
|
|
119 |
|
|
|
120 |
/**
|
|
|
121 |
* Copy constructor
|
|
|
122 |
* @param rhs Reference to the <code>ComponentFile</code> from which the data is copied.
|
|
|
123 |
*/
|
|
|
124 |
ComponentFile(const ComponentFile& rhs);
|
|
|
125 |
|
|
|
126 |
/**
|
|
|
127 |
* Destructor
|
|
|
128 |
*/
|
|
|
129 |
virtual ~ComponentFile();
|
|
|
130 |
|
|
|
131 |
/**
|
|
|
132 |
* Returns the file id.
|
|
|
133 |
* @return Reference to a <code>string</code> object representing the file id.
|
|
|
134 |
*/
|
|
|
135 |
virtual const string& ID() const;
|
|
|
136 |
|
|
|
137 |
/**
|
|
|
138 |
* Returns the file name.
|
|
|
139 |
* @return Reference to a <code>string</code> object representing the file name.
|
|
|
140 |
*/
|
|
|
141 |
virtual const string& FileName() const;
|
|
|
142 |
|
|
|
143 |
/**
|
|
|
144 |
* Returns the path of the file.
|
|
|
145 |
* @return Reference to a <code>string</code> object representing the path.
|
|
|
146 |
*/
|
|
|
147 |
virtual const string& Path() const;
|
|
|
148 |
|
|
|
149 |
/**
|
|
|
150 |
* Sets the file id.
|
|
|
151 |
* @param ID Reference to a <code>string</code> represeting the file id.
|
|
|
152 |
*/
|
|
|
153 |
virtual void SetID(const string& ID);
|
|
|
154 |
|
|
|
155 |
/**
|
|
|
156 |
* Sets the file name.
|
|
|
157 |
* @param name Reference to a <code>string</code> represeting the file name.
|
|
|
158 |
*/
|
|
|
159 |
virtual void SetFileName(const string& name);
|
|
|
160 |
|
|
|
161 |
/**
|
|
|
162 |
* Sets the path.
|
|
|
163 |
* @param path Reference to a <code>string</code> represeting the path.
|
|
|
164 |
*/
|
|
|
165 |
virtual void SetPath(const string& path);
|
|
|
166 |
|
|
|
167 |
/**
|
|
|
168 |
* Returns the owner component.
|
|
|
169 |
* @return Pointer to the component in which this file belongs.
|
|
|
170 |
*/
|
|
|
171 |
virtual Component* GetComponent() const;
|
|
|
172 |
|
|
|
173 |
/**
|
|
|
174 |
* Sets the owner component.
|
|
|
175 |
* Pointer to the <code>Component</code> object. Does not take the ownership.
|
|
|
176 |
*/
|
|
|
177 |
virtual void SetComponent(Component* comp);
|
|
|
178 |
|
|
|
179 |
/**
|
|
|
180 |
* Assignment operator
|
|
|
181 |
*/
|
|
|
182 |
virtual const ComponentFile& operator= (const ComponentFile& rhs);
|
|
|
183 |
|
|
|
184 |
/**
|
|
|
185 |
* Comparison operator
|
|
|
186 |
*/
|
|
|
187 |
virtual bool operator== (const ComponentFile& rhs) const;
|
|
|
188 |
|
|
|
189 |
/**
|
|
|
190 |
* Returns the include directives defined for this element
|
|
|
191 |
* @return Reference to the <code>std::vector</code> containing include directives
|
|
|
192 |
*/
|
|
|
193 |
virtual const vector<string>& Includes() const;
|
|
|
194 |
|
|
|
195 |
/**
|
|
|
196 |
* Adds include directive (string) to the object
|
|
|
197 |
* @param incHdr name of the header to be included
|
|
|
198 |
*/
|
|
|
199 |
virtual void AddInclude(const string& incHdr);
|
|
|
200 |
|
|
|
201 |
/**
|
|
|
202 |
* Adds include directives to the object
|
|
|
203 |
* @param incs Reference to the <code>std::vector</code> containing the include directives.
|
|
|
204 |
*/
|
|
|
205 |
virtual void SetIncludes(const vector<string>& incs);
|
|
|
206 |
|
|
|
207 |
/**
|
|
|
208 |
* Returns the include paths used in compilation of the project
|
|
|
209 |
* @return Reference to a <code>vector</code> containing <code>string</code>
|
|
|
210 |
* objects that represent the include paths.
|
|
|
211 |
*/
|
|
|
212 |
const vector<string>& IncludePaths() const;
|
|
|
213 |
|
|
|
214 |
/**
|
|
|
215 |
* Adds an include path
|
|
|
216 |
* @param incPath Reference to a <code>string</code> object representing
|
|
|
217 |
* the include path.
|
|
|
218 |
*/
|
|
|
219 |
void AddIncludePath(const string& incPath);
|
|
|
220 |
|
|
|
221 |
|
|
|
222 |
/**
|
|
|
223 |
* Returns the forced include used in compilation of the component
|
|
|
224 |
* @return a string object representing the forced include.
|
|
|
225 |
*/
|
|
|
226 |
string ForcedInclude();
|
|
|
227 |
|
|
|
228 |
/**
|
|
|
229 |
* Returns pair of string , with API name and category
|
|
|
230 |
*/
|
|
|
231 |
pair<string,string>& APIinfo();
|
|
|
232 |
|
|
|
233 |
protected:
|
|
|
234 |
|
|
|
235 |
// From ParsedElement:
|
|
|
236 |
virtual void ProcessAttributes(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* node);
|
|
|
237 |
virtual bool ProcessChildElement(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* node, PlatformData* platform);
|
|
|
238 |
|
|
|
239 |
string iID; // File id
|
|
|
240 |
string iName; // File name
|
|
|
241 |
string iPath; // Path
|
|
|
242 |
pair<string,string> iApiInfo; // API info for the header
|
|
|
243 |
Component* iComponent; // Component, does not own the pointer
|
|
|
244 |
vector<string> iIncludes; // Include directives
|
|
|
245 |
vector<string> iIncludePaths; // Include paths
|
|
|
246 |
string iForcedInclude; // Forced include
|
|
|
247 |
};
|
|
|
248 |
|
|
|
249 |
typedef vector<ComponentFile*> FileList;
|
|
|
250 |
|
|
|
251 |
/**
|
|
|
252 |
* This class represents the project. Project belongs to one component and
|
|
|
253 |
* has a list of include and source paths as well as the source files
|
|
|
254 |
* belonging to the project.
|
|
|
255 |
*/
|
|
|
256 |
class Project : public ComponentFile
|
|
|
257 |
{
|
|
|
258 |
public:
|
|
|
259 |
|
|
|
260 |
/**
|
|
|
261 |
* Default constructor
|
|
|
262 |
*/
|
|
|
263 |
Project();
|
|
|
264 |
|
|
|
265 |
/**
|
|
|
266 |
* Constructor
|
|
|
267 |
* @param prjID Project file id
|
|
|
268 |
* @param comp Pointer to the <code>Component</code> object in which
|
|
|
269 |
* this project belongs.
|
|
|
270 |
*/
|
|
|
271 |
Project(const string& prjID, Component* comp);
|
|
|
272 |
|
|
|
273 |
/**
|
|
|
274 |
* Destructor
|
|
|
275 |
*/
|
|
|
276 |
virtual ~Project();
|
|
|
277 |
|
|
|
278 |
/**
|
|
|
279 |
* Returns the list of <code>Source</code> objects contained by this project
|
|
|
280 |
* @return Reference to the list of <code>Source</code> objects.
|
|
|
281 |
*/
|
|
|
282 |
const FileList& Sources() const;
|
|
|
283 |
|
|
|
284 |
// From ParsedElement:
|
|
|
285 |
virtual string PrettyPrint(int indentSpaces = 0) const;
|
|
|
286 |
|
|
|
287 |
protected:
|
|
|
288 |
|
|
|
289 |
// From ParsedElement:
|
|
|
290 |
virtual bool AddToPlatform(PlatformData* platform);
|
|
|
291 |
virtual bool ProcessChildElement(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* node, PlatformData* platform);
|
|
|
292 |
FileList iSourceObjs; // Source objects belonging to this project
|
|
|
293 |
};
|
|
|
294 |
|
|
|
295 |
|
|
|
296 |
/**
|
|
|
297 |
* This class represents the header file, which belongs to one component.
|
|
|
298 |
* It has a analysis status telling whether the header should be ignored
|
|
|
299 |
* from the analysis or it is just being analyzed or the analysis is ready.
|
|
|
300 |
*/
|
|
|
301 |
class Header : public ComponentFile
|
|
|
302 |
{
|
|
|
303 |
public:
|
|
|
304 |
|
|
|
305 |
enum STATUS {
|
|
|
306 |
HDR_STATUS_UNDEF = 0, // Undefined status
|
|
|
307 |
HDR_STATUS_IGNORE, // Header should be ignored from the analysis
|
|
|
308 |
HDR_STATUS_TO_BE_ANALYZED, // Header will be analyzed
|
|
|
309 |
HDR_STATUS_READY, // Analysis for the header is ready
|
|
|
310 |
HDR_STATUS_INVALID,// Invalid header
|
|
|
311 |
HDR_STATUS_FAILED // Analysis and/or compilation failed
|
|
|
312 |
};
|
|
|
313 |
|
|
|
314 |
/**
|
|
|
315 |
* Default constructor
|
|
|
316 |
*/
|
|
|
317 |
Header();
|
|
|
318 |
|
|
|
319 |
/**
|
|
|
320 |
* Constructor
|
|
|
321 |
* @param hdrID Header file id
|
|
|
322 |
* @param comp Pointer to the component in which this header belongs.
|
|
|
323 |
*/
|
|
|
324 |
Header(const string& hdrID, Component* comp);
|
|
|
325 |
|
|
|
326 |
/**
|
|
|
327 |
* Destructor
|
|
|
328 |
*/
|
|
|
329 |
virtual ~Header();
|
|
|
330 |
|
|
|
331 |
/**
|
|
|
332 |
* Returns the status of the header
|
|
|
333 |
* @return Status of the header
|
|
|
334 |
*/
|
|
|
335 |
STATUS Status() const;
|
|
|
336 |
|
|
|
337 |
/**
|
|
|
338 |
* Sets the status of the header
|
|
|
339 |
* @param s Status of the header.
|
|
|
340 |
*/
|
|
|
341 |
void SetStatus(STATUS s);
|
|
|
342 |
|
|
|
343 |
// From ParsedElement:
|
|
|
344 |
virtual string PrettyPrint(int indentSpaces = 0) const;
|
|
|
345 |
|
|
|
346 |
/**
|
|
|
347 |
* Returns pointer to the cached include directives. Once the include directives
|
|
|
348 |
* are fetched by <code>PlatformData</code>, they are cached for further use to
|
|
|
349 |
* speed up the analysis.
|
|
|
350 |
*
|
|
|
351 |
* @return Pointer to the <code>std::vector</code> containing cached include
|
|
|
352 |
* directives
|
|
|
353 |
*/
|
|
|
354 |
const vector<string>* CachedIncludes() const;
|
|
|
355 |
|
|
|
356 |
/**
|
|
|
357 |
* Returns pointer to the cached include paths. Once the include paths
|
|
|
358 |
* are fetched by <code>PlatformData</code>, they are cached for further use to
|
|
|
359 |
* speed up the analysis.
|
|
|
360 |
*
|
|
|
361 |
* @return Pointer to the <code>std::vector</code> containing cached include
|
|
|
362 |
* paths
|
|
|
363 |
*/
|
|
|
364 |
const vector<string>* CachedIncludePaths() const;
|
|
|
365 |
|
|
|
366 |
/**
|
|
|
367 |
* Returns the cached forced include directive. Once the forced include directive
|
|
|
368 |
* is fetched by <code>PlatformData</code>, it is cached for further use to
|
|
|
369 |
* speed up the analysis.
|
|
|
370 |
*
|
|
|
371 |
* @return cached forced include
|
|
|
372 |
* directives
|
|
|
373 |
*/
|
|
|
374 |
string CachedForcedInclude() const;
|
|
|
375 |
|
|
|
376 |
/**
|
|
|
377 |
* Returns the cached source object for the header.
|
|
|
378 |
*/
|
|
|
379 |
string CachedSource() const;
|
|
|
380 |
|
|
|
381 |
|
|
|
382 |
/**
|
|
|
383 |
* Sets cached include directives. Takes the ownership of the given pointer.
|
|
|
384 |
* @param Pointer to the include directives
|
|
|
385 |
*/
|
|
|
386 |
void SetCachedIncludes(vector<string>* incs);
|
|
|
387 |
|
|
|
388 |
/**
|
|
|
389 |
* Sets cached include paths. Takes the ownership of the given pointer.
|
|
|
390 |
* @param Pointer to the include directives
|
|
|
391 |
*/
|
|
|
392 |
void SetCachedIncludePaths(vector<string>* incPaths);
|
|
|
393 |
|
|
|
394 |
/**
|
|
|
395 |
* Sets cached forced include directive.
|
|
|
396 |
* @param Forced include directive
|
|
|
397 |
*/
|
|
|
398 |
void SetCachedForcedInclude(string finc);
|
|
|
399 |
|
|
|
400 |
/**
|
|
|
401 |
* Sets cached soource file.
|
|
|
402 |
* @param source File
|
|
|
403 |
*/
|
|
|
404 |
void SetCachedSourceFile (string srcObj);
|
|
|
405 |
|
|
|
406 |
protected:
|
|
|
407 |
|
|
|
408 |
// From ParsedElement:
|
|
|
409 |
virtual void ProcessAttributes(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* node);
|
|
|
410 |
virtual bool AddToPlatform(PlatformData* platform);
|
|
|
411 |
|
|
|
412 |
private:
|
|
|
413 |
STATUS iStatus; // Header's status
|
|
|
414 |
vector<string>* iCachedIncludes; // Cached additional include directives. Owns the pointer!!
|
|
|
415 |
vector<string>* iCachedIncludePaths; // Cached include paths. Owns the pointer!!
|
|
|
416 |
string iCachedForcedInclude; // Cached forced include.
|
|
|
417 |
string iCacheSrcObj;
|
|
|
418 |
};
|
|
|
419 |
|
|
|
420 |
/**
|
|
|
421 |
* This class represents the source file belonging to a component.
|
|
|
422 |
* It has a list of include directives.
|
|
|
423 |
*/
|
|
|
424 |
class Source : public ComponentFile
|
|
|
425 |
{
|
|
|
426 |
public:
|
|
|
427 |
|
|
|
428 |
/**
|
|
|
429 |
* Default constructor
|
|
|
430 |
*/
|
|
|
431 |
Source();
|
|
|
432 |
|
|
|
433 |
/**
|
|
|
434 |
* Constructor
|
|
|
435 |
* @param srcID Source file id
|
|
|
436 |
* @param comp Pointer to the component
|
|
|
437 |
*/
|
|
|
438 |
Source(const string& srcID, Component* comp);
|
|
|
439 |
|
|
|
440 |
/**
|
|
|
441 |
* Destructor
|
|
|
442 |
*/
|
|
|
443 |
virtual ~Source();
|
|
|
444 |
|
|
|
445 |
// From ParsedElement:
|
|
|
446 |
virtual string PrettyPrint(int indentSpaces = 0) const;
|
|
|
447 |
|
|
|
448 |
protected:
|
|
|
449 |
// From ParsedElement:
|
|
|
450 |
virtual bool AddToPlatform(PlatformData* platform);
|
|
|
451 |
};
|
|
|
452 |
|
|
|
453 |
/**
|
|
|
454 |
* Component
|
|
|
455 |
*/
|
|
|
456 |
class Component : public ComponentFile
|
|
|
457 |
{
|
|
|
458 |
public:
|
|
|
459 |
/**
|
|
|
460 |
* Default constructor
|
|
|
461 |
*/
|
|
|
462 |
Component();
|
|
|
463 |
|
|
|
464 |
/**
|
|
|
465 |
* Constructor
|
|
|
466 |
* @param compID Unique component ID
|
|
|
467 |
*/
|
|
|
468 |
Component(const string& compID, Component* comp);
|
|
|
469 |
|
|
|
470 |
/**
|
|
|
471 |
* Destructor
|
|
|
472 |
*/
|
|
|
473 |
virtual ~Component();
|
|
|
474 |
|
|
|
475 |
/**
|
|
|
476 |
* Returns the header objects belonging to this component.
|
|
|
477 |
* @return Header objects.
|
|
|
478 |
*/
|
|
|
479 |
const FileList& Headers() const;
|
|
|
480 |
|
|
|
481 |
/**
|
|
|
482 |
* Returns the header objects belonging to this component.
|
|
|
483 |
* @return Header objects.
|
|
|
484 |
*/
|
|
|
485 |
FileList& Headers();
|
|
|
486 |
|
|
|
487 |
/**
|
|
|
488 |
* Returns the project objects belonging to this component.
|
|
|
489 |
* @return Project objects.
|
|
|
490 |
*/
|
|
|
491 |
const FileList& Projects() const;
|
|
|
492 |
|
|
|
493 |
/**
|
|
|
494 |
* Returns the project objects belonging to this component.
|
|
|
495 |
* @return Project objects.
|
|
|
496 |
*/
|
|
|
497 |
FileList& Projects();
|
|
|
498 |
|
|
|
499 |
/**
|
|
|
500 |
* Adds <code>Header</code> object to the component
|
|
|
501 |
* @param hdr Pointer to the <code>Header</code> object.
|
|
|
502 |
*/
|
|
|
503 |
void AddHeader(ComponentFile* hdr);
|
|
|
504 |
|
|
|
505 |
/**
|
|
|
506 |
* Adds <code>Project</code> object to the component
|
|
|
507 |
* @param hdr Pointer to the <code>Project</code> object.
|
|
|
508 |
*/
|
|
|
509 |
void AddProject(ComponentFile* prj);
|
|
|
510 |
|
|
|
511 |
// From ParsedElement:
|
|
|
512 |
virtual string PrettyPrint(int indentSpaces = 0) const;
|
|
|
513 |
|
|
|
514 |
protected:
|
|
|
515 |
// From ParsedElement:
|
|
|
516 |
virtual bool AddToPlatform(PlatformData* platform);
|
|
|
517 |
virtual bool ProcessChildElement(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* node, PlatformData* platform);
|
|
|
518 |
|
|
|
519 |
FileList iHeaders; // Header objects
|
|
|
520 |
FileList iProjects; // Project objects
|
|
|
521 |
};
|
|
|
522 |
|
|
|
523 |
typedef map<string, ComponentFile*> CFileMap;
|
|
|
524 |
typedef map<string, Component*> ComponentList;
|
|
|
525 |
|
|
|
526 |
/**
|
|
|
527 |
* PlatformData class represents the platform specific data that is needed
|
|
|
528 |
* in compilation of platform's header files.
|
|
|
529 |
* This class contains methods that offer different views to the platform data
|
|
|
530 |
* in order to enable efficient data processing for the clients.
|
|
|
531 |
*/
|
|
|
532 |
class PlatformData
|
|
|
533 |
{
|
|
|
534 |
public:
|
|
|
535 |
|
|
|
536 |
/**
|
|
|
537 |
* Constructor
|
|
|
538 |
* @param pfVersion Platform version given in application parameters.
|
|
|
539 |
* @param rootDir Platform's root directory given in application parameters.
|
|
|
540 |
*/
|
|
|
541 |
PlatformData(const string& pfVersion, const string& rootDir);
|
|
|
542 |
|
|
|
543 |
/**
|
|
|
544 |
* Destructor
|
|
|
545 |
*/
|
|
|
546 |
virtual ~PlatformData();
|
|
|
547 |
|
|
|
548 |
/**
|
|
|
549 |
* Initializes the platform data. This method reads and parses the
|
|
|
550 |
* platform data from the given file and sorts the data in private
|
|
|
551 |
* containers for later use.
|
|
|
552 |
* @param dataFileName Platform data file name.
|
|
|
553 |
*/
|
|
|
554 |
void Initialize(const string& dataFileName);
|
|
|
555 |
|
|
|
556 |
/**
|
|
|
557 |
* Returns headers sorted by their file ids.
|
|
|
558 |
* @return Reference to the <code>CFileMap</code> object containing the
|
|
|
559 |
* headers sorted by their file ids.
|
|
|
560 |
*/
|
|
|
561 |
const CFileMap& HeadersById() const;
|
|
|
562 |
|
|
|
563 |
/**
|
|
|
564 |
* Returns headers having the given status sorted by their file ids.
|
|
|
565 |
* @param hdrStatus Header status. All the headers having this status
|
|
|
566 |
* are returned.
|
|
|
567 |
* @param Reference to the <code>CFileMap</code> object in which the
|
|
|
568 |
* the headers matching the hdrStatus are returned.
|
|
|
569 |
*/
|
|
|
570 |
void HeadersByStatus(Header::STATUS hdrStatus, CFileMap& hdrFiles) const;
|
|
|
571 |
|
|
|
572 |
/**
|
|
|
573 |
* Returns projects sorted by their file ids.
|
|
|
574 |
* @return Reference to the <code>CFileMap</code> object containing the
|
|
|
575 |
* projects sorted by their file ids.
|
|
|
576 |
*/
|
|
|
577 |
const CFileMap& ProjectsById() const;
|
|
|
578 |
|
|
|
579 |
/**
|
|
|
580 |
* Returns projects sorted by their file ids.
|
|
|
581 |
* @return Reference to the <code>CFileMap</code> object containing the
|
|
|
582 |
* projects sorted by their file ids.
|
|
|
583 |
*/
|
|
|
584 |
CFileMap& ProjectsById();
|
|
|
585 |
|
|
|
586 |
/**
|
|
|
587 |
* Returns sources sorted by their file ids.
|
|
|
588 |
* @return Reference to the <code>CFileMap</code> object containing the
|
|
|
589 |
* sources sorted by their file ids.
|
|
|
590 |
*/
|
|
|
591 |
const CFileMap& SourcesById() const;
|
|
|
592 |
|
|
|
593 |
/**
|
|
|
594 |
* Gets include paths needed in compilation of the given header
|
|
|
595 |
* @param headerID ID of the header file.
|
|
|
596 |
* @param incPaths Include paths needed in compilation of the header.
|
|
|
597 |
*/
|
|
|
598 |
const vector<string>& IncludePathsForHeader(const string& headerID);
|
|
|
599 |
|
|
|
600 |
/**
|
|
|
601 |
* Gets include paths needed in compilation of the given header
|
|
|
602 |
* @param headerObj Pointer to the header file object.
|
|
|
603 |
* @param incPaths Include paths needed in compilation of the header.
|
|
|
604 |
*/
|
|
|
605 |
const vector<string>& IncludePathsForHeader(Header* headerObj);
|
|
|
606 |
|
|
|
607 |
/**
|
|
|
608 |
* Gets additional include directives needed in compilation of the given header
|
|
|
609 |
* @param headerID ID of the header file.
|
|
|
610 |
* @param incs Include directives needed in compilation of the header.
|
|
|
611 |
*/
|
|
|
612 |
const vector<string>& IncludesForHeader(const string& headerID);
|
|
|
613 |
|
|
|
614 |
/**
|
|
|
615 |
* Gets additional include directives needed in compilation of the given header
|
|
|
616 |
* @param headerObj Pointer to the header file object.
|
|
|
617 |
* @param incs Include directives needed in compilation of the header.
|
|
|
618 |
*/
|
|
|
619 |
const vector<string>& IncludesForHeader(Header* headerObj, Header* baseHObj = NULL);
|
|
|
620 |
|
|
|
621 |
/**
|
|
|
622 |
* Adds component to the component list. Takes the ownership of the pointer.
|
|
|
623 |
* @param comp Pointer to the <code>Component</code> object.
|
|
|
624 |
*/
|
|
|
625 |
bool AddComponent(Component* comp);
|
|
|
626 |
|
|
|
627 |
/**
|
|
|
628 |
* Adds project to the project list. Takes the ownership of the pointer.
|
|
|
629 |
* @param prj Pointer to the <code>Project</code> object.
|
|
|
630 |
*/
|
|
|
631 |
bool AddProject(Project* prj);
|
|
|
632 |
|
|
|
633 |
/**
|
|
|
634 |
* Adds header to the header list. Takes the ownership of the pointer.
|
|
|
635 |
* @param hdr Pointer to the <code>Header</code> object.
|
|
|
636 |
*/
|
|
|
637 |
bool AddHeader(Header* hdr);
|
|
|
638 |
|
|
|
639 |
/**
|
|
|
640 |
* Adds source to the source list. Takes the ownership of the pointer.
|
|
|
641 |
* @param src Pointer to the <code>Source</code> object.
|
|
|
642 |
*/
|
|
|
643 |
bool AddSource(Source* src);
|
|
|
644 |
|
|
|
645 |
/**
|
|
|
646 |
* Factory method creating correct element type for the given <code>DOMNode</code>.
|
|
|
647 |
* @param node Pointer to the <code>DOMNode</code>.
|
|
|
648 |
* @return Pointer to the created object.
|
|
|
649 |
*/
|
|
|
650 |
ParsedElement* CreateElement( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* node );
|
|
|
651 |
|
|
|
652 |
/**
|
|
|
653 |
* Returns the list of components
|
|
|
654 |
* @return Reference to the component list
|
|
|
655 |
*/
|
|
|
656 |
const ComponentList& Components() const;
|
|
|
657 |
|
|
|
658 |
/**
|
|
|
659 |
* Prints the elements read from the platform data file.
|
|
|
660 |
* For debugging purposes.
|
|
|
661 |
* @return string representing the platform data.
|
|
|
662 |
*/
|
|
|
663 |
string PrettyPrint() const;
|
|
|
664 |
|
|
|
665 |
/**
|
|
|
666 |
* Returns the root directory of the platform.
|
|
|
667 |
* @return Root directory string
|
|
|
668 |
*/
|
|
|
669 |
const string& GetRootDir() const;
|
|
|
670 |
|
|
|
671 |
private:
|
|
|
672 |
void IncludesFromSource(const Header* hObj, const Source* srcObj, vector<string>& includes) const;
|
|
|
673 |
vector<string> iDummyStringVector;
|
|
|
674 |
void InitializeElements();
|
|
|
675 |
ComponentList iCList; // All components in platform
|
|
|
676 |
CFileMap iHeadersById; // All headers in platform
|
|
|
677 |
CFileMap iSourcesById; // All sources in platform
|
|
|
678 |
CFileMap iProjectsById; // All projects in platform
|
|
|
679 |
|
|
|
680 |
// Pointer to DOMBuilder
|
|
|
681 |
XERCES_CPP_NAMESPACE_QUALIFIER DOMBuilder* iDOMParser;
|
|
|
682 |
// Pointer to DOMDocument
|
|
|
683 |
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* iDOMDoc;
|
|
|
684 |
// Pointer to DOM root node
|
|
|
685 |
XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* iDOMRootElement;
|
|
|
686 |
|
|
|
687 |
string iRootDir; // Root directory
|
|
|
688 |
string iPfVersion; // Version string given in constructor.
|
|
|
689 |
string iVersionStr; // Read from the XML-file (versionid attribute)
|
|
|
690 |
};
|
|
|
691 |
|
|
|
692 |
#endif
|