source: pacpusframework/trunk/include/Pacpus/kernel/XmlConfigFile.h@ 333

Last change on this file since 333 was 299, checked in by Marek Kurdej, 11 years ago

Separated PACPUS_DEPRECATED macros from pacpus.h into deprecated.h.

  • Property svn:executable set to *
File size: 3.4 KB
Line 
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/deprecated.h>
26#include <Pacpus/kernel/PacpusLibConfig.h>
27#include <Pacpus/kernel/XmlComponentConfig.h>
28
29#include <QDomElement>
30#include <QFile>
31#include <QMutex>
32#include <QStringList>
33
34class QFile;
35
36namespace pacpus {
37
38/// XML config properties:
39/// list STRING(S) name(s) of plugin files to be loaded, separated by pipe symbol '|'
40/// e.g. dbt="libDbtPlyGps.so|libDbtPlyVision.so
41class PACPUSLIB_API XmlConfigFile
42{
43 friend XmlComponentConfig::XmlComponentConfig(QString const&);
44 friend class ComponentManager;
45
46public:
47 /// @todo Documentation
48 static XmlConfigFile * create();
49 /// @todo Documentation
50 static void destroy();
51
52 /// @returns a list of all names of components declared in the XML tree
53 QStringList getAllComponentsNames() const;
54 /// @todo Documentation
55 QDomElement getComponent(QString name) const;
56
57 // TODO: QStringList getAllConnectionsNames() const;
58 QDomElement getConnection(QString connectionName) const;
59
60 /// @todo Documentation
61 QStringList getAllPluginsNames();
62
63 /// @todo Documentation
64 int loadFile(QString fileName);
65
66 /// @todo Documentation
67 /// not used
68 void saveFile(QString fileName);
69
70 /// @todo Documentation
71 /// not used
72 void addComponent(QDomElement component);
73
74 /// @todo Documentation
75 /// @deprecated Use removeComponent()
76 /// not used
77 PACPUS_DEPRECATED_MSG( void delComponent(QDomElement component), "use removeComponent()" );
78 void removeComponent(QDomElement component);
79
80protected:
81 QDomElement getSection(const char * name) const;
82 QDomNodeList getNodesInSection(const char * sectionName, const char * nodeName) const;
83
84 QDomNodeList getAllComponents() const;
85 QDomNodeList getAllConnections() const;
86 QDomNodeList getAllParameters() const;
87 QDomNodeList getAllPlugins();
88
89private:
90 XmlConfigFile();
91 ~XmlConfigFile();
92
93 QDomElement createComponent(QString name);
94
95 QString libraryExtension() const;
96 QString libraryPrefix() const;
97 QString libraryPostfix() const;
98
99private:
100 static XmlConfigFile * m_xmlConfigFile;
101
102 QDomDocument m_document;
103 QFile m_file;
104 QMutex m_mutex;
105
106 QString m_libraryExtension;
107 QString m_libraryPrefix;
108 QString m_libraryPostfix;
109
110 int m_numberOfComponents;
111};
112
113} // namespace pacpus
114
115#endif // DEF_PACPUS_XMLCONFIGFILE_H
Note: See TracBrowser for help on using the repository browser.