[89] | 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 getAllComponentsNames();
|
---|
| 53 | /// @todo Documentation
|
---|
| 54 | QStringList getAllPlugins();
|
---|
| 55 | /// @todo Documentation
|
---|
| 56 | int loadFile(QString fileName);
|
---|
| 57 |
|
---|
| 58 | QDomNodeList getAllComponents();
|
---|
| 59 |
|
---|
| 60 | QDomNodeList getAllConnections();
|
---|
| 61 |
|
---|
| 62 | QDomElement getConnection(QString connectionName);
|
---|
| 63 |
|
---|
| 64 | /// @todo Documentation
|
---|
| 65 | /// not used
|
---|
| 66 | void saveFile(QString fileName);
|
---|
| 67 | /// @todo Documentation
|
---|
| 68 | /// not used
|
---|
| 69 | void addComponent(QDomElement component);
|
---|
| 70 | /// @todo Documentation
|
---|
| 71 | /// not used
|
---|
| 72 | void delComponent(QDomElement component);
|
---|
| 73 |
|
---|
| 74 | protected:
|
---|
| 75 | private:
|
---|
| 76 | XmlConfigFile();
|
---|
| 77 | ~XmlConfigFile();
|
---|
| 78 |
|
---|
| 79 | static XmlConfigFile * _xmlConfigFile;
|
---|
| 80 |
|
---|
| 81 | QDomElement createComponent(QString name);
|
---|
| 82 |
|
---|
| 83 | private:
|
---|
| 84 | QDomDocument _document;
|
---|
| 85 | QFile * _file;
|
---|
| 86 | QMutex _mutex;
|
---|
| 87 |
|
---|
| 88 | int _numberOfComponents;
|
---|
| 89 | };
|
---|
| 90 |
|
---|
| 91 | } // namespace pacpus
|
---|
| 92 |
|
---|
| 93 | #endif // DEF_PACPUS_XMLCONFIGFILE_H
|
---|