Salome HOME
Merge branch 'master' of newgeom:newgeom.git
[modules/shaper.git] / src / Config / Config_Prop.h
1 // File:        Config_Prop.h
2 // Created:     12 Aug 2014
3 // Author:      Vitaly SMETANNIKOV
4
5 #ifndef Config_Prop_H
6 #define Config_Prop_H
7
8 #include "Config_def.h"
9
10 #include <string>
11 #include <list>
12
13 /// Class which describes a one property
14 class Config_Prop
15 {
16  public:
17
18   enum PropType
19   {
20     Disabled,
21     Space,
22     Bool,
23     Color,
24     String,
25     Selector,
26     DblSpin,
27     IntSpin,
28     Double,
29     Integer,
30     GroupBox,
31     Tab,
32     Frame,
33     Font,
34     DirList,
35     File,
36     Slider,
37     Shortcut,
38     ShortcutTree,
39     BiColor,
40     Background
41   };
42
43   /** 
44    * Creates a one property
45    * \param theSection - name of section (domain of using) of the property.
46    * \param theName - name (title) of the value.
47    * \param theType - type of the value.
48    * \param theValue - initial value of the property.
49    */
50   Config_Prop(const std::string& theSection, const std::string& theName,
51               const std::string& theTitle, PropType theType, const std::string& theValue)
52   {
53     mySection = theSection;
54     myName = theName;
55     myTitle = theTitle;
56     myType = theType;
57     myValue = theValue;
58   }
59
60   std::string section() const
61   {
62     return mySection;
63   }
64   std::string name() const
65   {
66     return myName;
67   }
68
69   std::string title() const
70   {
71     return myTitle;
72   }
73   void setTitle(const std::string& theTitle)
74   {
75     myTitle = theTitle;
76   }
77
78   PropType type() const
79   {
80     return myType;
81   }
82   void setType(PropType theType)
83   {
84     myType = theType;
85   }
86
87   std::string value() const
88   {
89     return myValue;
90   }
91
92   CONFIG_EXPORT void setValue(const std::string& theValue);
93
94   bool operator==(const Config_Prop* theProp) const
95   {
96     return (mySection == theProp->section()) && (myName == theProp->name());
97   }
98
99  private:
100   std::string mySection;
101   std::string myName;
102   std::string myTitle;
103   PropType myType;
104   std::string myValue;
105 };
106
107 typedef std::list<Config_Prop*> Config_Properties;
108
109 #endif