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

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

Fixed: using auto-generated PacpusLibConfig.h instead of pacpus.h.

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