Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[modules/shaper.git] / src / Config / Config_Prop.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        Config_Prop.h
4 // Created:     12 Aug 2014
5 // Author:      Vitaly SMETANNIKOV
6
7 #ifndef CONFIG_PROP_H
8 #define CONFIG_PROP_H
9
10 #include "Config_def.h"
11
12 #include <string>
13 #include <list>
14
15 /*!
16  * \class Config_Prop
17  * \brief Class which describes a one property
18  * \ingroup Config
19  */
20 class Config_Prop
21 {
22  public:
23
24   /// Type of stored property
25   enum PropType
26   {
27     Disabled,
28     Space,
29     Boolean,
30     Color,
31     String,
32     Selector,
33     DblSpin,
34     IntSpin,
35     Double,
36     Integer,
37     GroupBox,
38     Tab,
39     Frame,
40     Font,
41     DirList,
42     File,
43     Slider,
44     Shortcut,
45     ShortcutTree,
46     BiColor,
47     Background,
48     Directory
49   };
50
51   /** 
52    * Creates a one property
53    * \param theSection - name of section (domain of using) of the property.
54    * \param theName - name (title) of the value.
55    * \param theTitle - title of the value
56    * \param theType - type of the value.
57    * \param theDefaultValue - default value of the property. This is an initial property value
58    */
59   Config_Prop(const std::string& theSection, const std::string& theName,
60               const std::string& theTitle, PropType theType, const std::string& theDefaultValue)
61   {
62     mySection = theSection;
63     myName = theName;
64     myTitle = theTitle;
65     myType = theType;
66     myValue = theDefaultValue;
67     myDefaultValue = theDefaultValue;
68   }
69
70   /// Get name of section
71   std::string section() const
72   {
73     return mySection;
74   }
75   /// Get name of property
76   std::string name() const
77   {
78     return myName;
79   }
80   /// Get title of property
81   std::string title() const
82   {
83     return myTitle;
84   }
85   /// Set title of property
86   void setTitle(const std::string& theTitle)
87   {
88     myTitle = theTitle;
89   }
90   /// Get type of property
91   PropType type() const
92   {
93     return myType;
94   }
95   /// Set type of property
96   void setType(PropType theType)
97   {
98     myType = theType;
99   }
100   /// Get property's value in string format
101   std::string value() const
102   {
103     return myValue;
104   }
105   /// Set property's value in string format
106   CONFIG_EXPORT void setValue(const std::string& theValue);
107   /// Get default value of property
108   std::string defaultValue() const
109   {
110     return myDefaultValue;
111   }
112   /// Set default value of property
113   CONFIG_EXPORT void setDefaultValue(const std::string& theValue);
114   /// Alows to compare Config_Prop with each other
115   bool operator==(const Config_Prop* theProp) const
116   {
117     return (mySection == theProp->section()) && (myName == theProp->name());
118   }
119
120  private:
121   std::string mySection; ///< Name of section
122   std::string myName; ///< Name of property
123   std::string myTitle; ///< Title of property
124   PropType myType; ///< Type of property
125   std::string myValue; // Value in string format
126   std::string myDefaultValue; // Default value
127 };
128
129 typedef std::list<Config_Prop*> Config_Properties;
130
131 #endif