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

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

Added: PacpusException - base class for all exceptions. DbiteExceptions inherits from it.
Added: PacpusLibConfig.h - dllimport/dllexport clauses separated from pacpus.h.
Update: comments.

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