Salome HOME
Merge branch 'Dev_0.6.1' of newgeom:newgeom into Dev_0.6.1
[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 /// Class which describes a one property
16 class Config_Prop
17 {
18  public:
19
20   enum PropType
21   {
22     Disabled,
23     Space,
24     Bool,
25     Color,
26     String,
27     Selector,
28     DblSpin,
29     IntSpin,
30     Double,
31     Integer,
32     GroupBox,
33     Tab,
34     Frame,
35     Font,
36     DirList,
37     File,
38     Slider,
39     Shortcut,
40     ShortcutTree,
41     BiColor,
42     Background,
43     Directory
44   };
45
46   /** 
47    * Creates a one property
48    * \param theSection - name of section (domain of using) of the property.
49    * \param theName - name (title) of the value.
50    * \param theType - type of the value.
51    * \param theDefaultValue - default value of the property. This is an initial property value
52    */
53   Config_Prop(const std::string& theSection, const std::string& theName,
54               const std::string& theTitle, PropType theType, const std::string& theDefaultValue)
55   {
56     mySection = theSection;
57     myName = theName;
58     myTitle = theTitle;
59     myType = theType;
60     myValue = theDefaultValue;
61     myDefaultValue = theDefaultValue;
62   }
63
64   std::string section() const
65   {
66     return mySection;
67   }
68   std::string name() const
69   {
70     return myName;
71   }
72
73   std::string title() const
74   {
75     return myTitle;
76   }
77   void setTitle(const std::string& theTitle)
78   {
79     myTitle = theTitle;
80   }
81
82   PropType type() const
83   {
84     return myType;
85   }
86   void setType(PropType theType)
87   {
88     myType = theType;
89   }
90
91   std::string value() const
92   {
93     return myValue;
94   }
95
96   CONFIG_EXPORT void setValue(const std::string& theValue);
97   
98   std::string defaultValue() const
99   {
100     return myDefaultValue;
101   }
102
103   CONFIG_EXPORT void setDefaultValue(const std::string& theValue);
104
105   bool operator==(const Config_Prop* theProp) const
106   {
107     return (mySection == theProp->section()) && (myName == theProp->name());
108   }
109
110  private:
111   std::string mySection;
112   std::string myName;
113   std::string myTitle;
114   PropType myType;
115   std::string myValue;
116   std::string myDefaultValue;
117 };
118
119 typedef std::list<Config_Prop*> Config_Properties;
120
121 #endif