[31] | 1 | /**
|
---|
| 2 | *
|
---|
| 3 | * Distributed under the UTC Heudiascy Pacpus License, Version 1.0.
|
---|
| 4 | * Copyright (c) UTC Heudiasyc 2010 - 2013. All rights reserved.
|
---|
| 5 | *
|
---|
| 6 | * See the LICENSE file for more information or a copy at:
|
---|
| 7 | * http://www.hds.utc.fr/~kurdejma/LICENSE_1_0.txt
|
---|
| 8 | *
|
---|
| 9 | */
|
---|
[3] | 10 |
|
---|
[31] | 11 | #ifndef DEF_PACPUS_XMLCONFIGFILE_H
|
---|
| 12 | #define DEF_PACPUS_XMLCONFIGFILE_H
|
---|
[3] | 13 |
|
---|
[31] | 14 | #include <Pacpus/kernel/pacpus.h>
|
---|
| 15 | #include <Pacpus/kernel/XmlComponentConfig.h>
|
---|
[3] | 16 |
|
---|
| 17 | #include <QDomElement>
|
---|
| 18 | #include <QMutex>
|
---|
| 19 | #include <QStringList>
|
---|
| 20 |
|
---|
| 21 | class QFile;
|
---|
| 22 |
|
---|
| 23 | namespace pacpus {
|
---|
| 24 |
|
---|
| 25 | /// XML config properties:
|
---|
| 26 | /// list STRING(S) name(s) of plugin files to be loaded, separated by pipe symbol '|'
|
---|
| 27 | /// e.g. dbt="libDbtPlyGps.so|libDbtPlyVision.so
|
---|
| 28 | class PACPUSLIB_API XmlConfigFile
|
---|
| 29 | {
|
---|
| 30 | friend XmlComponentConfig::XmlComponentConfig(const QString&);
|
---|
| 31 | friend class ComponentManager;
|
---|
| 32 |
|
---|
| 33 | public:
|
---|
[53] | 34 | /// @todo Documentation
|
---|
[3] | 35 | static XmlConfigFile * create();
|
---|
[53] | 36 | /// @todo Documentation
|
---|
[3] | 37 | static void destroy();
|
---|
[53] | 38 | /// @todo Documentation
|
---|
[3] | 39 | QDomElement getComponent(QString name);
|
---|
[53] | 40 | /// @returns a list of all names of components declared in the XML tree
|
---|
[3] | 41 | QStringList getAllComponents();
|
---|
[53] | 42 | /// @todo Documentation
|
---|
[3] | 43 | QStringList getAllPlugins();
|
---|
[53] | 44 | /// @todo Documentation
|
---|
[3] | 45 | int loadFile(QString fileName);
|
---|
| 46 |
|
---|
[53] | 47 | /// @todo Documentation
|
---|
| 48 | /// not used
|
---|
[3] | 49 | void saveFile(QString fileName);
|
---|
[53] | 50 | /// @todo Documentation
|
---|
| 51 | /// not used
|
---|
[3] | 52 | void addComponent(QDomElement component);
|
---|
[53] | 53 | /// @todo Documentation
|
---|
| 54 | /// not used
|
---|
[3] | 55 | void delComponent(QDomElement component);
|
---|
| 56 |
|
---|
| 57 | protected:
|
---|
| 58 | private:
|
---|
| 59 | XmlConfigFile();
|
---|
| 60 | ~XmlConfigFile();
|
---|
| 61 |
|
---|
| 62 | static XmlConfigFile * _xmlConfigFile;
|
---|
| 63 |
|
---|
| 64 | QDomElement createComponent(QString name);
|
---|
| 65 |
|
---|
| 66 | private:
|
---|
| 67 | QDomDocument _document;
|
---|
| 68 | QFile * _file;
|
---|
| 69 | QMutex _mutex;
|
---|
| 70 |
|
---|
| 71 | int _numberOfComponents;
|
---|
| 72 | };
|
---|
| 73 |
|
---|
| 74 | } // namespace pacpus
|
---|
| 75 |
|
---|
[31] | 76 | #endif // DEF_PACPUS_XMLCONFIGFILE_H
|
---|