source: pacpusframework/trunk/include/Pacpus/kernel/XmlComponentConfig.h@ 63

Last change on this file since 63 was 63, checked in by Marek Kurdej, 11 years ago

Documentation: file info.

File size: 3.5 KB
Line 
1// This file is part of the PACPUS framework distributed under the
2// CECILL-C License, Version 1.0.
3//
4/// @author Gerald Dherbomez <firstname.surname@utc.fr>
5/// @date January, 2006
6/// @version $Id$
7/// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved.
8/// @brief Brief description.
9///
10/// Purpose: definit la structure XML des paramètres de configuration
11/// d'un composant
12
13#ifndef DEF_PACPUS_XMLCOMPONENTCONFIG_H
14#define DEF_PACPUS_XMLCOMPONENTCONFIG_H
15
16#include <Pacpus/kernel/pacpus.h>
17
18#include <QDomElement>
19
20namespace pacpus {
21
22class XmlConfigFile;
23
24/** XmlComponentConfig
25 * @brief Defines the XML structure of a component.
26 */
27class PACPUSLIB_API XmlComponentConfig
28{
29 friend class ComponentManager;
30public:
31 /** Ctor of XmlComponentConfig.
32 * @param name Name of the ComponentFactory, by convention equal to class name.
33 */
34 explicit XmlComponentConfig(const QString& name = QString::null);
35
36 /** Dtor of XmlComponentConfig. */
37 ~XmlComponentConfig();
38
39 /** Add the property @em name to the XML and set its value to @em 0 if it does not exist.
40 * @param name Name of the property.
41 */
42 void addProperty(const QString& name);
43
44 /** Delete a property from the XML.
45 * @return False if the property does not exist, false otherwise.
46 */
47 int delProperty(const QString& name);
48
49 /** Get the value of a property.
50 * @param name Name of the property.
51 * @param defaultValue Value returned if the property does not exist.
52 * @return Value of the property, @em defaultValue otherwise.
53 */
54 QString getProperty(const QString& name, const QString& defaultValue = QString::null) const;
55
56 /** Get the value of a property as a boolean.
57 * @param name Name of the property.
58 * @param defaultValue Value returned if the property does not exist.
59 * @return Value of the property, @em defaultValue otherwise.
60 */
61 int getBoolProperty(const QString& name, bool defaultValue = false) const;
62
63 /** Get the value of a property as an integer.
64 * @param name Name of the property.
65 * @param defaultValue Value returned if the property does not exist.
66 * @return Value of the property, @em defaultValue otherwise.
67 */
68 int getIntProperty(const QString& name, int defaultValue = 0) const;
69
70 /** Get the value of a property as a double.
71 * @param name Name of the property.
72 * @param defaultValue Value returned if the property does not exist.
73 * @return Value of the property, @em defaultValue otherwise.
74 */
75 int getDoubleProperty(const QString& name, double defaultValue = 0.0) const;
76
77 /** Set the value of a property.
78 * @param name Name of the property.
79 * @param value Value to set.
80 */
81 void setProperty(const QString& name, const QString& value);
82
83 /** Check if a property exists.
84 * @param name Name of the property.
85 * @return True if the property exists, false otherwise.
86 */
87 bool hasProperty(const QString& name) const;
88
89private:
90 // Returns the local QDomElement.
91 QDomElement qDomElement() const;
92
93 // Copy internally the node in the internal QDomElement.
94 void localCopy(const QDomElement& elementToCopy);
95
96 QString const getComponentName() const;
97 QString const getComponentType() const;
98
99private:
100 QDomElement component_;
101 XmlConfigFile * parentDocument_;
102};
103
104} // namespace pacpus
105
106#endif // DEF_PACPUS_XMLCOMPONENTCONFIG_H
Note: See TracBrowser for help on using the repository browser.