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 | static XmlConfigFile * create();
|
---|
35 | static void destroy();
|
---|
36 | QDomElement getComponent(QString name);
|
---|
37 | QStringList getAllComponents();
|
---|
38 | QStringList getAllPlugins();
|
---|
39 | int loadFile(QString fileName);
|
---|
40 |
|
---|
41 | // not used
|
---|
42 | void saveFile(QString fileName);
|
---|
43 | // not used
|
---|
44 | void addComponent(QDomElement component);
|
---|
45 | // not used
|
---|
46 | void delComponent(QDomElement component);
|
---|
47 |
|
---|
48 | protected:
|
---|
49 | private:
|
---|
50 | XmlConfigFile();
|
---|
51 | ~XmlConfigFile();
|
---|
52 |
|
---|
53 | static XmlConfigFile * _xmlConfigFile;
|
---|
54 |
|
---|
55 | QDomElement createComponent(QString name);
|
---|
56 |
|
---|
57 | private:
|
---|
58 | QDomDocument _document;
|
---|
59 | QFile * _file;
|
---|
60 | QMutex _mutex;
|
---|
61 |
|
---|
62 | int _numberOfComponents;
|
---|
63 | };
|
---|
64 |
|
---|
65 | } // namespace pacpus
|
---|
66 |
|
---|
67 | #endif // DEF_PACPUS_XMLCONFIGFILE_H
|
---|