source: pacpusframework/branches/2.0-beta1/include/Pacpus/kernel/XmlConfigFile.h@ 165

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

Major: changed plugins section name to plugings. Parameters section will be used for something else.

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