SHAPER  9.12.0
Config_Prop.h
1 // Copyright (C) 2014-2023 CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef CONFIG_PROP_H
21 #define CONFIG_PROP_H
22 
23 #include "Config_def.h"
24 
25 #include <string>
26 #include <list>
27 
28 static const char SKETCH_TAB_NAME[] = "Sketch";
29 
36 {
37  public:
38 
40  enum PropType
41  {
42  Disabled,
43  Space,
44  Boolean,
45  Color,
46  String,
47  Selector,
48  DblSpin,
49  IntSpin,
50  Double,
51  Integer,
52  GroupBox,
53  Tab,
54  Frame,
55  Font,
56  DirList,
57  File,
58  Slider,
59  Shortcut,
60  ShortcutTree,
61  BiColor,
62  Background,
63  Directory,
64  Cursor
65  };
66 
67  enum CursorType
68  {
69  ArrowCursor,
70  CrossCursor,
71  HandCursor
72  };
73 
82  Config_Prop(const std::string& theSection, const std::string& theName,
83  const std::string& theTitle, PropType theType,
84  const std::string& theDefaultValue,
85  const std::string& theMin, const std::string& theMax)
86  {
87  mySection = theSection;
88  myName = theName;
89  myTitle = theTitle;
90  myType = theType;
91  myValue = theDefaultValue;
92  myDefaultValue = theDefaultValue;
93  myMin = theMin;
94  myMax = theMax;
95  }
96 
98  std::string section() const
99  {
100  return mySection;
101  }
103  std::string name() const
104  {
105  return myName;
106  }
108  std::string title() const
109  {
110  return myTitle;
111  }
113  void setTitle(const std::string& theTitle)
114  {
115  myTitle = theTitle;
116  }
118  PropType type() const
119  {
120  return myType;
121  }
123  void setType(PropType theType)
124  {
125  myType = theType;
126  }
128  std::string value() const
129  {
130  return myValue;
131  }
133  CONFIG_EXPORT void setValue(const std::string& theValue);
135  std::string defaultValue() const
136  {
137  return myDefaultValue;
138  }
140  CONFIG_EXPORT void setDefaultValue(const std::string& theValue);
142  bool operator==(const Config_Prop* theProp) const
143  {
144  return (mySection == theProp->section()) && (myName == theProp->name());
145  }
146 
148  std::string min() const { return myMin; }
149 
150  void setMin(const std::string& theMin) {
151  myMin = theMin;
152  }
153 
155  std::string max() const { return myMax; }
156 
157  void setMax(const std::string& theMax) {
158  myMax = theMax;
159  }
160 
161  private:
162  std::string mySection;
163  std::string myName;
164  std::string myTitle;
165  PropType myType;
166  std::string myValue; // Value in string format
167  std::string myDefaultValue; // Default value
168  std::string myMin; // Minimal value
169  std::string myMax; // Maximal value
170 };
171 
172 typedef std::list<Config_Prop*> Config_Properties;
173 
174 #endif
Class which describes a one property.
Definition: Config_Prop.h:36
PropType type() const
Get type of property.
Definition: Config_Prop.h:118
std::string min() const
Returns minimal value.
Definition: Config_Prop.h:148
Config_Prop(const std::string &theSection, const std::string &theName, const std::string &theTitle, PropType theType, const std::string &theDefaultValue, const std::string &theMin, const std::string &theMax)
Creates a one property.
Definition: Config_Prop.h:82
void setValue(const std::string &theValue)
Set property's value in string format.
Definition: Config_Prop.cpp:24
std::string name() const
Get name of property.
Definition: Config_Prop.h:103
void setTitle(const std::string &theTitle)
Set title of property.
Definition: Config_Prop.h:113
void setType(PropType theType)
Set type of property.
Definition: Config_Prop.h:123
std::string value() const
Get property's value in string format.
Definition: Config_Prop.h:128
std::string defaultValue() const
Get default value of property.
Definition: Config_Prop.h:135
std::string title() const
Get title of property.
Definition: Config_Prop.h:108
PropType
Type of stored property.
Definition: Config_Prop.h:41
void setDefaultValue(const std::string &theValue)
Set default value of property.
Definition: Config_Prop.cpp:34
bool operator==(const Config_Prop *theProp) const
Alows to compare Config_Prop with each other.
Definition: Config_Prop.h:142
std::string max() const
Returns maximal value.
Definition: Config_Prop.h:155
std::string section() const
Get name of section.
Definition: Config_Prop.h:98