[76] | 1 | // %pacpus:license{
|
---|
[62] | 2 | // This file is part of the PACPUS framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[76] | 4 | // %pacpus:license}
|
---|
[66] | 5 | /// @file
|
---|
[63] | 6 | /// @author Gerald Dherbomez <firstname.surname@utc.fr>
|
---|
| 7 | /// @date January, 2006
|
---|
[62] | 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 | ///
|
---|
[63] | 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
|
---|
[3] | 21 |
|
---|
[31] | 22 | #ifndef DEF_PACPUS_XMLCONFIGFILE_H
|
---|
| 23 | #define DEF_PACPUS_XMLCONFIGFILE_H
|
---|
[3] | 24 |
|
---|
[31] | 25 | #include <Pacpus/kernel/pacpus.h>
|
---|
| 26 | #include <Pacpus/kernel/XmlComponentConfig.h>
|
---|
[3] | 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:
|
---|
[53] | 45 | /// @todo Documentation
|
---|
[3] | 46 | static XmlConfigFile * create();
|
---|
[53] | 47 | /// @todo Documentation
|
---|
[3] | 48 | static void destroy();
|
---|
[53] | 49 | /// @todo Documentation
|
---|
[3] | 50 | QDomElement getComponent(QString name);
|
---|
[53] | 51 | /// @returns a list of all names of components declared in the XML tree
|
---|
[3] | 52 | QStringList getAllComponents();
|
---|
[53] | 53 | /// @todo Documentation
|
---|
[3] | 54 | QStringList getAllPlugins();
|
---|
[53] | 55 | /// @todo Documentation
|
---|
[3] | 56 | int loadFile(QString fileName);
|
---|
| 57 |
|
---|
[53] | 58 | /// @todo Documentation
|
---|
| 59 | /// not used
|
---|
[3] | 60 | void saveFile(QString fileName);
|
---|
[53] | 61 | /// @todo Documentation
|
---|
| 62 | /// not used
|
---|
[3] | 63 | void addComponent(QDomElement component);
|
---|
[53] | 64 | /// @todo Documentation
|
---|
| 65 | /// not used
|
---|
[3] | 66 | void delComponent(QDomElement component);
|
---|
| 67 |
|
---|
| 68 | protected:
|
---|
| 69 | private:
|
---|
| 70 | XmlConfigFile();
|
---|
| 71 | ~XmlConfigFile();
|
---|
| 72 |
|
---|
| 73 | static XmlConfigFile * _xmlConfigFile;
|
---|
| 74 |
|
---|
| 75 | QDomElement createComponent(QString name);
|
---|
| 76 |
|
---|
| 77 | private:
|
---|
| 78 | QDomDocument _document;
|
---|
| 79 | QFile * _file;
|
---|
| 80 | QMutex _mutex;
|
---|
| 81 |
|
---|
| 82 | int _numberOfComponents;
|
---|
| 83 | };
|
---|
| 84 |
|
---|
| 85 | } // namespace pacpus
|
---|
| 86 |
|
---|
[31] | 87 | #endif // DEF_PACPUS_XMLCONFIGFILE_H
|
---|