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

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

Update: refactoring in XmlConfigFile.
Added: attributes 'prefix', 'postfix', 'extension' in <parameters>.
Example: <parameters prefix="" postfix="_d" extension="dll">

  • Property svn:executable set to *
File size: 3.2 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 QDomNodeList getAllComponents() const;
81 QDomNodeList getAllConnections() const;
82 QDomNodeList getAllPlugins();
83
84private:
85 XmlConfigFile();
86 ~XmlConfigFile();
87
88 QDomElement createComponent(QString name);
89
90 QString libraryExtension() const;
91 QString libraryPrefix() const;
92 QString libraryPostfix() const;
93
94private:
95 static XmlConfigFile * m_xmlConfigFile;
96
97 QDomDocument m_document;
98 QFile m_file;
99 QMutex m_mutex;
100
101 QString m_libraryExtension;
102 QString m_libraryPrefix;
103 QString m_libraryPostfix;
104
105 int m_numberOfComponents;
106};
107
108} // namespace pacpus
109
110#endif // DEF_PACPUS_XMLCONFIGFILE_H
Note: See TracBrowser for help on using the repository browser.