[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 116 2013-06-25 11:44:25Z kurdejma $
|
---|
| 9 | /// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved.
|
---|
| 10 | /// @brief Brief description.
|
---|
| 11 | ///
|
---|
[91] | 12 | /// Purpose: Class that manages the XML file. This file is used to configure permettant d'enregistrer un fichier de
|
---|
| 13 | /// a PACPUS application.
|
---|
| 14 | /// The XML file includes 2 sections :
|
---|
| 15 | /// - parameters : parameters of the application
|
---|
| 16 | /// - components : a list of components to load
|
---|
[3] | 17 |
|
---|
[31] | 18 | #ifndef DEF_PACPUS_XMLCONFIGFILE_H
|
---|
| 19 | #define DEF_PACPUS_XMLCONFIGFILE_H
|
---|
[3] | 20 |
|
---|
[116] | 21 | #include <Pacpus/kernel/PacpusLibConfig.h>
|
---|
[31] | 22 | #include <Pacpus/kernel/XmlComponentConfig.h>
|
---|
[3] | 23 |
|
---|
| 24 | #include <QDomElement>
|
---|
| 25 | #include <QMutex>
|
---|
| 26 | #include <QStringList>
|
---|
| 27 |
|
---|
| 28 | class QFile;
|
---|
| 29 |
|
---|
| 30 | namespace pacpus {
|
---|
| 31 |
|
---|
| 32 | /// XML config properties:
|
---|
| 33 | /// list STRING(S) name(s) of plugin files to be loaded, separated by pipe symbol '|'
|
---|
| 34 | /// e.g. dbt="libDbtPlyGps.so|libDbtPlyVision.so
|
---|
| 35 | class PACPUSLIB_API XmlConfigFile
|
---|
| 36 | {
|
---|
| 37 | friend XmlComponentConfig::XmlComponentConfig(const QString&);
|
---|
| 38 | friend class ComponentManager;
|
---|
| 39 |
|
---|
| 40 | public:
|
---|
[53] | 41 | /// @todo Documentation
|
---|
[3] | 42 | static XmlConfigFile * create();
|
---|
[53] | 43 | /// @todo Documentation
|
---|
[3] | 44 | static void destroy();
|
---|
[53] | 45 | /// @todo Documentation
|
---|
[3] | 46 | QDomElement getComponent(QString name);
|
---|
[53] | 47 | /// @returns a list of all names of components declared in the XML tree
|
---|
[3] | 48 | QStringList getAllComponents();
|
---|
[53] | 49 | /// @todo Documentation
|
---|
[3] | 50 | QStringList getAllPlugins();
|
---|
[53] | 51 | /// @todo Documentation
|
---|
[3] | 52 | int loadFile(QString fileName);
|
---|
| 53 |
|
---|
[53] | 54 | /// @todo Documentation
|
---|
| 55 | /// not used
|
---|
[3] | 56 | void saveFile(QString fileName);
|
---|
[53] | 57 | /// @todo Documentation
|
---|
| 58 | /// not used
|
---|
[3] | 59 | void addComponent(QDomElement component);
|
---|
[53] | 60 | /// @todo Documentation
|
---|
| 61 | /// not used
|
---|
[3] | 62 | void delComponent(QDomElement component);
|
---|
| 63 |
|
---|
| 64 | protected:
|
---|
| 65 | private:
|
---|
| 66 | XmlConfigFile();
|
---|
| 67 | ~XmlConfigFile();
|
---|
| 68 |
|
---|
| 69 | static XmlConfigFile * _xmlConfigFile;
|
---|
| 70 |
|
---|
| 71 | QDomElement createComponent(QString name);
|
---|
| 72 |
|
---|
| 73 | private:
|
---|
| 74 | QDomDocument _document;
|
---|
| 75 | QFile * _file;
|
---|
| 76 | QMutex _mutex;
|
---|
| 77 |
|
---|
| 78 | int _numberOfComponents;
|
---|
| 79 | };
|
---|
| 80 |
|
---|
| 81 | } // namespace pacpus
|
---|
| 82 |
|
---|
[31] | 83 | #endif // DEF_PACPUS_XMLCONFIGFILE_H
|
---|