Salome HOME
Preferences improvement
[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 { Disabled, Space, Bool, Color, String, Selector,
19                   DblSpin, IntSpin, Double, Integer,
20                   GroupBox, Tab, Frame, Font, DirList, File,
21                               Slider, Shortcut, ShortcutTree, BiColor, Background };
22
23
24   /** 
25   * Creates a one property
26   * \param theSection - name of section (domain of using) of the property.
27   * \param theName - name (title) of the value.
28   * \param theType - type of the value.
29   * \param theValue - initial value of the property.
30   */
31   Config_Prop(const std::string& theSection,
32               const std::string& theName,
33               const std::string& theTitle,
34               PropType theType,
35               const std::string& theValue ) {
36     mySection = theSection;
37     myName = theName;
38     myTitle = theTitle;
39     myType = theType;
40     myValue = theValue;
41   }
42
43   std::string section() const { return mySection; }
44   std::string name() const { return myName; }
45
46   std::string title() const { return myTitle; }
47   void setTitle(const std::string& theTitle) { myTitle = theTitle; }
48
49   PropType type() const { return myType; }
50   void setType(PropType theType) { myType = theType; }
51
52   std::string value() const { return myValue; }
53   void setValue(const std::string& theValue) { myValue = theValue; }
54
55   bool operator==(const Config_Prop* theProp) const
56   {
57     return (mySection == theProp->section()) && (myName == theProp->name());
58   }
59
60 private:
61   std::string mySection;
62   std::string myName;
63   std::string myTitle;
64   PropType myType;
65   std::string myValue;
66 };
67
68 typedef std::list<Config_Prop*> Config_Properties;
69
70 #endif