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

Last change on this file since 81 was 79, checked in by Marek Kurdej, 12 years ago

Minor: reverted heading changes from revision 78.
Left: corrected return types.

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