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 76 2013-01-10 17:05:10Z kurdejma $
|
---|
9 | /// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved.
|
---|
10 | /// @brief Brief description.
|
---|
11 | ///
|
---|
12 | /// Purpose: Classe permettant d'enregistrer un fichier de
|
---|
13 | /// configuration XML
|
---|
14 | /// Le fichier XML contient 2 sections :
|
---|
15 | /// - parameters : contient les parametres de l'application
|
---|
16 | /// - components : contient les composants
|
---|
17 | /// les composants ne peuvent pas avoir de noeuds fils
|
---|
18 | ///
|
---|
19 | /// @todo Creer une dtd qui permet de definir la liste des classes possibles
|
---|
20 | /// que peuvent prendre les composants
|
---|
21 |
|
---|
22 | #ifndef DEF_PACPUS_XMLCONFIGFILE_H
|
---|
23 | #define DEF_PACPUS_XMLCONFIGFILE_H
|
---|
24 |
|
---|
25 | #include <Pacpus/kernel/pacpus.h>
|
---|
26 | #include <Pacpus/kernel/XmlComponentConfig.h>
|
---|
27 |
|
---|
28 | #include <QDomElement>
|
---|
29 | #include <QMutex>
|
---|
30 | #include <QStringList>
|
---|
31 |
|
---|
32 | class QFile;
|
---|
33 |
|
---|
34 | namespace pacpus {
|
---|
35 |
|
---|
36 | /// XML config properties:
|
---|
37 | /// list STRING(S) name(s) of plugin files to be loaded, separated by pipe symbol '|'
|
---|
38 | /// e.g. dbt="libDbtPlyGps.so|libDbtPlyVision.so
|
---|
39 | class PACPUSLIB_API XmlConfigFile
|
---|
40 | {
|
---|
41 | friend XmlComponentConfig::XmlComponentConfig(const QString&);
|
---|
42 | friend class ComponentManager;
|
---|
43 |
|
---|
44 | public:
|
---|
45 | /// @todo Documentation
|
---|
46 | static XmlConfigFile * create();
|
---|
47 | /// @todo Documentation
|
---|
48 | static void destroy();
|
---|
49 | /// @todo Documentation
|
---|
50 | QDomElement getComponent(QString name);
|
---|
51 | /// @returns a list of all names of components declared in the XML tree
|
---|
52 | QStringList getAllComponents();
|
---|
53 | /// @todo Documentation
|
---|
54 | QStringList getAllPlugins();
|
---|
55 | /// @todo Documentation
|
---|
56 | int loadFile(QString fileName);
|
---|
57 |
|
---|
58 | /// @todo Documentation
|
---|
59 | /// not used
|
---|
60 | void saveFile(QString fileName);
|
---|
61 | /// @todo Documentation
|
---|
62 | /// not used
|
---|
63 | void addComponent(QDomElement component);
|
---|
64 | /// @todo Documentation
|
---|
65 | /// not used
|
---|
66 | void delComponent(QDomElement component);
|
---|
67 |
|
---|
68 | protected:
|
---|
69 | private:
|
---|
70 | XmlConfigFile();
|
---|
71 | ~XmlConfigFile();
|
---|
72 |
|
---|
73 | static XmlConfigFile * _xmlConfigFile;
|
---|
74 |
|
---|
75 | QDomElement createComponent(QString name);
|
---|
76 |
|
---|
77 | private:
|
---|
78 | QDomDocument _document;
|
---|
79 | QFile * _file;
|
---|
80 | QMutex _mutex;
|
---|
81 |
|
---|
82 | int _numberOfComponents;
|
---|
83 | };
|
---|
84 |
|
---|
85 | } // namespace pacpus
|
---|
86 |
|
---|
87 | #endif // DEF_PACPUS_XMLCONFIGFILE_H
|
---|