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

Last change on this file since 113 was 91, checked in by DHERBOMEZ Gérald, 11 years ago

Improvement of the build system to avoid some workarounds

  • Property svn:keywords set to Id
File size: 3.5 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 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///
12/// Purpose: This class manages a XML node corresponding to a PACPUS component.
13
14#ifndef DEF_PACPUS_XMLCOMPONENTCONFIG_H
15#define DEF_PACPUS_XMLCOMPONENTCONFIG_H
16
17#include <Pacpus/kernel/pacpus.h>
18
19#include <QDomElement>
20
21namespace pacpus {
22
23class XmlConfigFile;
24
25/** XmlComponentConfig
26 * @brief Defines the XML structure of a component.
27 */
28class PACPUSLIB_API XmlComponentConfig
29{
30 friend class ComponentManager;
31public:
32 /** Ctor of XmlComponentConfig.
33 * @param name Name of the ComponentFactory, by convention equal to class name.
34 */
35 explicit XmlComponentConfig(const QString& name = QString::null);
36
37 /** Dtor of XmlComponentConfig. */
38 ~XmlComponentConfig();
39
40 /** Add the property @em name to the XML and set its value to @em 0 if it does not exist.
41 * @param name Name of the property.
42 */
43 void addProperty(const QString& name);
44
45 /** Delete a property from the XML.
46 * @return False if the property does not exist, false otherwise.
47 */
48 int delProperty(const QString& name);
49
50 /** Get the value of a property.
51 * @param name Name of the property.
52 * @param defaultValue Value returned if the property does not exist.
53 * @return Value of the property, @em defaultValue otherwise.
54 */
55 QString getProperty(const QString& name, const QString& defaultValue = QString::null) const;
56
57 /** Get the value of a property as a boolean.
58 * @param name Name of the property.
59 * @param defaultValue Value returned if the property does not exist.
60 * @return Value of the property, @em defaultValue otherwise.
61 */
62 bool getBoolProperty(const QString& name, bool defaultValue = false) const;
63
64 /** Get the value of a property as an integer.
65 * @param name Name of the property.
66 * @param defaultValue Value returned if the property does not exist.
67 * @return Value of the property, @em defaultValue otherwise.
68 */
69 int getIntProperty(const QString& name, int defaultValue = 0) const;
70
71 /** Get the value of a property as a double.
72 * @param name Name of the property.
73 * @param defaultValue Value returned if the property does not exist.
74 * @return Value of the property, @em defaultValue otherwise.
75 */
76 double getDoubleProperty(const QString& name, double defaultValue = 0.0) const;
77
78 /** Set the value of a property.
79 * @param name Name of the property.
80 * @param value Value to set.
81 */
82 void setProperty(const QString& name, const QString& value);
83
84 /** Check if a property exists.
85 * @param name Name of the property.
86 * @return True if the property exists, false otherwise.
87 */
88 bool hasProperty(const QString& name) const;
89
90private:
91 // Returns the local QDomElement.
92 QDomElement qDomElement() const;
93
94 // Copy internally the node in the internal QDomElement.
95 void localCopy(const QDomElement& elementToCopy);
96
97 QString const getComponentName() const;
98 QString const getComponentType() const;
99
100private:
101 QDomElement component_;
102 XmlConfigFile * parentDocument_;
103};
104
105} // namespace pacpus
106
107#endif // DEF_PACPUS_XMLCOMPONENTCONFIG_H
Note: See TracBrowser for help on using the repository browser.