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