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 116 2013-06-25 11:44:25Z kurdejma $
|
---|
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 | #ifndef DEF_PACPUS_XMLCONFIGFILE_H
|
---|
19 | #define DEF_PACPUS_XMLCONFIGFILE_H
|
---|
20 |
|
---|
21 | #include <Pacpus/kernel/PacpusLibConfig.h>
|
---|
22 | #include <Pacpus/kernel/XmlComponentConfig.h>
|
---|
23 |
|
---|
24 | #include <QDomElement>
|
---|
25 | #include <QMutex>
|
---|
26 | #include <QStringList>
|
---|
27 |
|
---|
28 | class QFile;
|
---|
29 |
|
---|
30 | namespace pacpus {
|
---|
31 |
|
---|
32 | /// XML config properties:
|
---|
33 | /// list STRING(S) name(s) of plugin files to be loaded, separated by pipe symbol '|'
|
---|
34 | /// e.g. dbt="libDbtPlyGps.so|libDbtPlyVision.so
|
---|
35 | class PACPUSLIB_API XmlConfigFile
|
---|
36 | {
|
---|
37 | friend XmlComponentConfig::XmlComponentConfig(const QString&);
|
---|
38 | friend class ComponentManager;
|
---|
39 |
|
---|
40 | public:
|
---|
41 | /// @todo Documentation
|
---|
42 | static XmlConfigFile * create();
|
---|
43 | /// @todo Documentation
|
---|
44 | static void destroy();
|
---|
45 | /// @todo Documentation
|
---|
46 | QDomElement getComponent(QString name);
|
---|
47 | /// @returns a list of all names of components declared in the XML tree
|
---|
48 | QStringList getAllComponents();
|
---|
49 | /// @todo Documentation
|
---|
50 | QStringList getAllPlugins();
|
---|
51 | /// @todo Documentation
|
---|
52 | int loadFile(QString fileName);
|
---|
53 |
|
---|
54 | /// @todo Documentation
|
---|
55 | /// not used
|
---|
56 | void saveFile(QString fileName);
|
---|
57 | /// @todo Documentation
|
---|
58 | /// not used
|
---|
59 | void addComponent(QDomElement component);
|
---|
60 | /// @todo Documentation
|
---|
61 | /// not used
|
---|
62 | void delComponent(QDomElement component);
|
---|
63 |
|
---|
64 | protected:
|
---|
65 | private:
|
---|
66 | XmlConfigFile();
|
---|
67 | ~XmlConfigFile();
|
---|
68 |
|
---|
69 | static XmlConfigFile * _xmlConfigFile;
|
---|
70 |
|
---|
71 | QDomElement createComponent(QString name);
|
---|
72 |
|
---|
73 | private:
|
---|
74 | QDomDocument _document;
|
---|
75 | QFile * _file;
|
---|
76 | QMutex _mutex;
|
---|
77 |
|
---|
78 | int _numberOfComponents;
|
---|
79 | };
|
---|
80 |
|
---|
81 | } // namespace pacpus
|
---|
82 |
|
---|
83 | #endif // DEF_PACPUS_XMLCONFIGFILE_H
|
---|