[62] | 1 | // This file is part of the PACPUS framework distributed under the
|
---|
| 2 | // CECILL-C License, Version 1.0.
|
---|
| 3 | //
|
---|
[66] | 4 | /// @file
|
---|
[63] | 5 | /// @author Gerald Dherbomez <firstname.surname@utc.fr>
|
---|
| 6 | /// @date January, 2006
|
---|
[62] | 7 | /// @version $Id: XmlConfigFile.h 66 2013-01-09 16:54:11Z kurdejma $
|
---|
| 8 | /// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved.
|
---|
| 9 | /// @brief Brief description.
|
---|
| 10 | ///
|
---|
[63] | 11 | /// Purpose: Classe permettant d'enregistrer un fichier de
|
---|
| 12 | /// configuration XML
|
---|
| 13 | /// Le fichier XML contient 2 sections :
|
---|
| 14 | /// - parameters : contient les parametres de l'application
|
---|
| 15 | /// - components : contient les composants
|
---|
| 16 | /// les composants ne peuvent pas avoir de noeuds fils
|
---|
| 17 | ///
|
---|
| 18 | /// @todo Creer une dtd qui permet de definir la liste des classes possibles
|
---|
| 19 | /// que peuvent prendre les composants
|
---|
[3] | 20 |
|
---|
[31] | 21 | #ifndef DEF_PACPUS_XMLCONFIGFILE_H
|
---|
| 22 | #define DEF_PACPUS_XMLCONFIGFILE_H
|
---|
[3] | 23 |
|
---|
[31] | 24 | #include <Pacpus/kernel/pacpus.h>
|
---|
| 25 | #include <Pacpus/kernel/XmlComponentConfig.h>
|
---|
[3] | 26 |
|
---|
| 27 | #include <QDomElement>
|
---|
| 28 | #include <QMutex>
|
---|
| 29 | #include <QStringList>
|
---|
| 30 |
|
---|
| 31 | class QFile;
|
---|
| 32 |
|
---|
| 33 | namespace pacpus {
|
---|
| 34 |
|
---|
| 35 | /// XML config properties:
|
---|
| 36 | /// list STRING(S) name(s) of plugin files to be loaded, separated by pipe symbol '|'
|
---|
| 37 | /// e.g. dbt="libDbtPlyGps.so|libDbtPlyVision.so
|
---|
| 38 | class PACPUSLIB_API XmlConfigFile
|
---|
| 39 | {
|
---|
| 40 | friend XmlComponentConfig::XmlComponentConfig(const QString&);
|
---|
| 41 | friend class ComponentManager;
|
---|
| 42 |
|
---|
| 43 | public:
|
---|
[53] | 44 | /// @todo Documentation
|
---|
[3] | 45 | static XmlConfigFile * create();
|
---|
[53] | 46 | /// @todo Documentation
|
---|
[3] | 47 | static void destroy();
|
---|
[53] | 48 | /// @todo Documentation
|
---|
[3] | 49 | QDomElement getComponent(QString name);
|
---|
[53] | 50 | /// @returns a list of all names of components declared in the XML tree
|
---|
[3] | 51 | QStringList getAllComponents();
|
---|
[53] | 52 | /// @todo Documentation
|
---|
[3] | 53 | QStringList getAllPlugins();
|
---|
[53] | 54 | /// @todo Documentation
|
---|
[3] | 55 | int loadFile(QString fileName);
|
---|
| 56 |
|
---|
[53] | 57 | /// @todo Documentation
|
---|
| 58 | /// not used
|
---|
[3] | 59 | void saveFile(QString fileName);
|
---|
[53] | 60 | /// @todo Documentation
|
---|
| 61 | /// not used
|
---|
[3] | 62 | void addComponent(QDomElement component);
|
---|
[53] | 63 | /// @todo Documentation
|
---|
| 64 | /// not used
|
---|
[3] | 65 | void delComponent(QDomElement component);
|
---|
| 66 |
|
---|
| 67 | protected:
|
---|
| 68 | private:
|
---|
| 69 | XmlConfigFile();
|
---|
| 70 | ~XmlConfigFile();
|
---|
| 71 |
|
---|
| 72 | static XmlConfigFile * _xmlConfigFile;
|
---|
| 73 |
|
---|
| 74 | QDomElement createComponent(QString name);
|
---|
| 75 |
|
---|
| 76 | private:
|
---|
| 77 | QDomDocument _document;
|
---|
| 78 | QFile * _file;
|
---|
| 79 | QMutex _mutex;
|
---|
| 80 |
|
---|
| 81 | int _numberOfComponents;
|
---|
| 82 | };
|
---|
| 83 |
|
---|
| 84 | } // namespace pacpus
|
---|
| 85 |
|
---|
[31] | 86 | #endif // DEF_PACPUS_XMLCONFIGFILE_H
|
---|