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