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