@@ -104,18 +104,18 @@ class Value {
104
104
operator int () const throw(WrongType);
105
105
operator double () const throw(WrongType);
106
106
operator char const * () const throw (WrongType);
107
- void SetValue (std::string const & in,Etype _type = V_CURRENT) throw(WrongType);
107
+ bool SetValue (std::string const & in,Etype _type = V_CURRENT) throw(WrongType);
108
108
std::string ToString () const ;
109
109
110
110
private:
111
111
void destroy () throw();
112
112
Value& copy (Value const & in) throw(WrongType);
113
113
void plaincopy (Value const & in) throw();
114
- void set_hex (std::string const & in);
115
- void set_int (std::string const &in);
116
- void set_bool (std::string const & in);
114
+ bool set_hex (std::string const & in);
115
+ bool set_int (std::string const &in);
116
+ bool set_bool (std::string const & in);
117
117
void set_string (std::string const & in);
118
- void set_double (std::string const & in);
118
+ bool set_double (std::string const & in);
119
119
};
120
120
121
121
class Property {
@@ -127,18 +127,20 @@ class Property {
127
127
void Set_values (const char * const * in);
128
128
void Set_help (std::string const & str);
129
129
char const * Get_help ();
130
- virtual void SetValue (std::string const & str)=0;
130
+ virtual bool SetValue (std::string const & str)=0;
131
131
Value const & GetValue () const { return value;}
132
132
Value const & Get_Default_Value () const { return default_value; }
133
133
// CheckValue returns true if value is in suggested_values;
134
134
// Type specific properties are encouraged to override this and check for type
135
135
// specific features.
136
136
virtual bool CheckValue (Value const & in, bool warn);
137
137
// Set interval value to in or default if in is invalid. force always sets the value.
138
- void SetVal (Value const & in, bool forced,bool warn=true ) {if (forced || CheckValue (in,warn)) value = in; else value = default_value;}
138
+ bool SetVal (Value const & in, bool forced,bool warn=true ) {
139
+ if (forced || CheckValue (in,warn)) {value = in; return true ;} else { value = default_value; return false ;}}
139
140
virtual ~Property (){ }
140
141
virtual const std::vector<Value>& GetValues () const ;
141
142
Value::Etype Get_type (){return default_value.type ;}
143
+ Changeable::Value getChange () {return change;}
142
144
143
145
protected:
144
146
Value value;
@@ -161,8 +163,10 @@ class Prop_int:public Property {
161
163
min = _min;
162
164
max = _max;
163
165
}
166
+ int getMin () { return min;}
167
+ int getMax () { return max;}
164
168
void SetMinMax (Value const & min,Value const & max) {this ->min = min; this ->max =max;}
165
- void SetValue (std::string const & in);
169
+ bool SetValue (std::string const & in);
166
170
~Prop_int (){ }
167
171
virtual bool CheckValue (Value const & in, bool warn);
168
172
private:
@@ -175,7 +179,7 @@ class Prop_double:public Property {
175
179
:Property(_propname,when){
176
180
default_value = value = _value;
177
181
}
178
- void SetValue (std::string const & input);
182
+ bool SetValue (std::string const & input);
179
183
~Prop_double (){ }
180
184
};
181
185
@@ -185,7 +189,7 @@ class Prop_bool:public Property {
185
189
:Property(_propname,when) {
186
190
default_value = value = _value;
187
191
}
188
- void SetValue (std::string const & in);
192
+ bool SetValue (std::string const & in);
189
193
~Prop_bool (){ }
190
194
};
191
195
@@ -195,7 +199,7 @@ class Prop_string:public Property{
195
199
:Property(_propname,when) {
196
200
default_value = value = _value;
197
201
}
198
- void SetValue (std::string const & in);
202
+ bool SetValue (std::string const & in);
199
203
virtual bool CheckValue (Value const & in, bool warn);
200
204
~Prop_string (){ }
201
205
};
@@ -207,7 +211,7 @@ class Prop_path:public Prop_string{
207
211
default_value = value = _value;
208
212
realpath = _value;
209
213
}
210
- void SetValue (std::string const & in);
214
+ bool SetValue (std::string const & in);
211
215
~Prop_path (){ }
212
216
};
213
217
@@ -217,7 +221,7 @@ class Prop_hex:public Property {
217
221
:Property(_propname,when) {
218
222
default_value = value = _value;
219
223
}
220
- void SetValue (std::string const & in);
224
+ bool SetValue (std::string const & in);
221
225
~Prop_hex (){ }
222
226
};
223
227
@@ -248,7 +252,7 @@ class Section {
248
252
const char * GetName () const {return sectionname.c_str ();}
249
253
250
254
virtual std::string GetPropValue (std::string const & _property) const =0;
251
- virtual void HandleInputline (std::string const & _line)=0;
255
+ virtual bool HandleInputline (std::string const & _line)=0;
252
256
virtual void PrintData (FILE* outfile) const =0;
253
257
virtual ~Section () { /* Children must call executedestroy ! */ }
254
258
};
@@ -281,7 +285,7 @@ class Section_prop:public Section {
281
285
Prop_path* Get_path (std::string const & _propname) const ;
282
286
Prop_multival* Get_multival (std::string const & _propname) const ;
283
287
Prop_multival_remain* Get_multivalremain (std::string const & _propname) const ;
284
- void HandleInputline (std::string const & gegevens);
288
+ bool HandleInputline (std::string const & gegevens);
285
289
void PrintData (FILE* outfile) const ;
286
290
virtual std::string GetPropValue (std::string const & _property) const ;
287
291
// ExecuteDestroy should be here else the destroy functions use destroyed properties
@@ -299,7 +303,7 @@ class Prop_multival:public Property{
299
303
}
300
304
Section_prop *GetSection () { return section; }
301
305
const Section_prop *GetSection () const { return section; }
302
- virtual void SetValue (std::string const & input);
306
+ virtual bool SetValue (std::string const & input);
303
307
virtual const std::vector<Value>& GetValues () const ;
304
308
~Prop_multival () { delete section; }
305
309
}; // value bevat totale string. setvalue zet elk van de sub properties en checked die.
@@ -308,15 +312,15 @@ class Prop_multival_remain:public Prop_multival{
308
312
public:
309
313
Prop_multival_remain (std::string const & _propname, Changeable::Value when,std::string const & sep):Prop_multival(_propname,when,sep){ }
310
314
311
- virtual void SetValue (std::string const & input);
315
+ virtual bool SetValue (std::string const & input);
312
316
};
313
317
314
318
315
319
class Section_line : public Section {
316
320
public:
317
321
Section_line (std::string const & _sectionname):Section(_sectionname){}
318
322
~Section_line (){ExecuteDestroy (true );}
319
- void HandleInputline (std::string const & gegevens);
323
+ bool HandleInputline (std::string const & gegevens);
320
324
void PrintData (FILE* outfile) const ;
321
325
virtual std::string GetPropValue (std::string const & _property) const ;
322
326
std::string data;
0 commit comments