]> SALOME platform Git repositories - modules/shaper.git/blob - src/Config/Config_Prop.h
Salome HOME
Merge branch 'master' of newgeom:newgeom
[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 theDefaultValue - default value of the property. This is an initial property value
49    */
50   Config_Prop(const std::string& theSection, const std::string& theName,
51               const std::string& theTitle, PropType theType, const std::string& theDefaultValue)
52   {
53     mySection = theSection;
54     myName = theName;
55     myTitle = theTitle;
56     myType = theType;
57     myValue = theDefaultValue;
58     myDefaultValue = theDefaultValue;
59   }
60
61   std::string section() const
62   {
63     return mySection;
64   }
65   std::string name() const
66   {
67     return myName;
68   }
69
70   std::string title() const
71   {
72     return myTitle;
73   }
74   void setTitle(const std::string& theTitle)
75   {
76     myTitle = theTitle;
77   }
78
79   PropType type() const
80   {
81     return myType;
82   }
83   void setType(PropType theType)
84   {
85     myType = theType;
86   }
87
88   std::string value() const
89   {
90     return myValue;
91   }
92
93   CONFIG_EXPORT void setValue(const std::string& theValue);
94   
95   std::string defaultValue() const
96   {
97     return myDefaultValue;
98   }
99
100   CONFIG_EXPORT void setDefaultValue(const std::string& theValue);
101
102   bool operator==(const Config_Prop* theProp) const
103   {
104     return (mySection == theProp->section()) && (myName == theProp->name());
105   }
106
107  private:
108   std::string mySection;
109   std::string myName;
110   std::string myTitle;
111   PropType myType;
112   std::string myValue;
113   std::string myDefaultValue;
114 };
115
116 typedef std::list<Config_Prop*> Config_Properties;
117
118 #endif