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

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

Documentation: file info.

  • Property svn:keywords set to Id
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/// @file
5/// @author Gerald Dherbomez <firstname.surname@utc.fr>
6/// @date January, 2006
7/// @version $Id: XmlComponentConfig.h 66 2013-01-09 16:54:11Z kurdejma $
8/// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved.
9/// @brief Brief description.
10///
11/// Purpose: definit la structure XML des paramètres de configuration
12/// d'un composant
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 int 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 int 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.