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