[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 91 2013-05-19 10:32:48Z gdherbom $
|
---|
| 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
|
---|
| 17 | ///
|
---|
[3] | 18 |
|
---|
[91] | 19 |
|
---|
[31] | 20 | #ifndef DEF_PACPUS_XMLCONFIGFILE_H
|
---|
| 21 | #define DEF_PACPUS_XMLCONFIGFILE_H
|
---|
[3] | 22 |
|
---|
[31] | 23 | #include <Pacpus/kernel/pacpus.h>
|
---|
| 24 | #include <Pacpus/kernel/XmlComponentConfig.h>
|
---|
[3] | 25 |
|
---|
| 26 | #include <QDomElement>
|
---|
| 27 | #include <QMutex>
|
---|
| 28 | #include <QStringList>
|
---|
| 29 |
|
---|
| 30 | class QFile;
|
---|
| 31 |
|
---|
| 32 | namespace pacpus {
|
---|
| 33 |
|
---|
| 34 | /// XML config properties:
|
---|
| 35 | /// list STRING(S) name(s) of plugin files to be loaded, separated by pipe symbol '|'
|
---|
| 36 | /// e.g. dbt="libDbtPlyGps.so|libDbtPlyVision.so
|
---|
| 37 | class PACPUSLIB_API XmlConfigFile
|
---|
| 38 | {
|
---|
| 39 | friend XmlComponentConfig::XmlComponentConfig(const QString&);
|
---|
| 40 | friend class ComponentManager;
|
---|
| 41 |
|
---|
| 42 | public:
|
---|
[53] | 43 | /// @todo Documentation
|
---|
[3] | 44 | static XmlConfigFile * create();
|
---|
[53] | 45 | /// @todo Documentation
|
---|
[3] | 46 | static void destroy();
|
---|
[53] | 47 | /// @todo Documentation
|
---|
[3] | 48 | QDomElement getComponent(QString name);
|
---|
[53] | 49 | /// @returns a list of all names of components declared in the XML tree
|
---|
[3] | 50 | QStringList getAllComponents();
|
---|
[53] | 51 | /// @todo Documentation
|
---|
[3] | 52 | QStringList getAllPlugins();
|
---|
[53] | 53 | /// @todo Documentation
|
---|
[3] | 54 | int loadFile(QString fileName);
|
---|
| 55 |
|
---|
[53] | 56 | /// @todo Documentation
|
---|
| 57 | /// not used
|
---|
[3] | 58 | void saveFile(QString fileName);
|
---|
[53] | 59 | /// @todo Documentation
|
---|
| 60 | /// not used
|
---|
[3] | 61 | void addComponent(QDomElement component);
|
---|
[53] | 62 | /// @todo Documentation
|
---|
| 63 | /// not used
|
---|
[3] | 64 | void delComponent(QDomElement component);
|
---|
| 65 |
|
---|
| 66 | protected:
|
---|
| 67 | private:
|
---|
| 68 | XmlConfigFile();
|
---|
| 69 | ~XmlConfigFile();
|
---|
| 70 |
|
---|
| 71 | static XmlConfigFile * _xmlConfigFile;
|
---|
| 72 |
|
---|
| 73 | QDomElement createComponent(QString name);
|
---|
| 74 |
|
---|
| 75 | private:
|
---|
| 76 | QDomDocument _document;
|
---|
| 77 | QFile * _file;
|
---|
| 78 | QMutex _mutex;
|
---|
| 79 |
|
---|
| 80 | int _numberOfComponents;
|
---|
| 81 | };
|
---|
| 82 |
|
---|
| 83 | } // namespace pacpus
|
---|
| 84 |
|
---|
[31] | 85 | #endif // DEF_PACPUS_XMLCONFIGFILE_H
|
---|