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