1 | // This file is part of the PACPUS framework distributed under the
|
---|
2 | // CECILL-C License, Version 1.0.
|
---|
3 | //
|
---|
4 | /// @author Firstname Surname <firstname.surname@utc.fr>
|
---|
5 | /// @date Month, Year
|
---|
6 | /// @version $Id$
|
---|
7 | /// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved.
|
---|
8 | /// @brief Brief description.
|
---|
9 | ///
|
---|
10 | /// Detailed description.
|
---|
11 |
|
---|
12 | #ifndef DEF_PACPUS_XMLCONFIGFILE_H
|
---|
13 | #define DEF_PACPUS_XMLCONFIGFILE_H
|
---|
14 |
|
---|
15 | #include <Pacpus/kernel/pacpus.h>
|
---|
16 | #include <Pacpus/kernel/XmlComponentConfig.h>
|
---|
17 |
|
---|
18 | #include <QDomElement>
|
---|
19 | #include <QMutex>
|
---|
20 | #include <QStringList>
|
---|
21 |
|
---|
22 | class QFile;
|
---|
23 |
|
---|
24 | namespace pacpus {
|
---|
25 |
|
---|
26 | /// XML config properties:
|
---|
27 | /// list STRING(S) name(s) of plugin files to be loaded, separated by pipe symbol '|'
|
---|
28 | /// e.g. dbt="libDbtPlyGps.so|libDbtPlyVision.so
|
---|
29 | class PACPUSLIB_API XmlConfigFile
|
---|
30 | {
|
---|
31 | friend XmlComponentConfig::XmlComponentConfig(const QString&);
|
---|
32 | friend class ComponentManager;
|
---|
33 |
|
---|
34 | public:
|
---|
35 | /// @todo Documentation
|
---|
36 | static XmlConfigFile * create();
|
---|
37 | /// @todo Documentation
|
---|
38 | static void destroy();
|
---|
39 | /// @todo Documentation
|
---|
40 | QDomElement getComponent(QString name);
|
---|
41 | /// @returns a list of all names of components declared in the XML tree
|
---|
42 | QStringList getAllComponents();
|
---|
43 | /// @todo Documentation
|
---|
44 | QStringList getAllPlugins();
|
---|
45 | /// @todo Documentation
|
---|
46 | int loadFile(QString fileName);
|
---|
47 |
|
---|
48 | /// @todo Documentation
|
---|
49 | /// not used
|
---|
50 | void saveFile(QString fileName);
|
---|
51 | /// @todo Documentation
|
---|
52 | /// not used
|
---|
53 | void addComponent(QDomElement component);
|
---|
54 | /// @todo Documentation
|
---|
55 | /// not used
|
---|
56 | void delComponent(QDomElement component);
|
---|
57 |
|
---|
58 | protected:
|
---|
59 | private:
|
---|
60 | XmlConfigFile();
|
---|
61 | ~XmlConfigFile();
|
---|
62 |
|
---|
63 | static XmlConfigFile * _xmlConfigFile;
|
---|
64 |
|
---|
65 | QDomElement createComponent(QString name);
|
---|
66 |
|
---|
67 | private:
|
---|
68 | QDomDocument _document;
|
---|
69 | QFile * _file;
|
---|
70 | QMutex _mutex;
|
---|
71 |
|
---|
72 | int _numberOfComponents;
|
---|
73 | };
|
---|
74 |
|
---|
75 | } // namespace pacpus
|
---|
76 |
|
---|
77 | #endif // DEF_PACPUS_XMLCONFIGFILE_H
|
---|