Add new features to the config command for control of the config file:
- manipulate the autoexec section - display information on sections and values - show the used config files and startup command line parameters - restart capability - save config files either in the config or program directory Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3651
This commit is contained in:
parent
0d7b792d05
commit
143beec6b1
15 changed files with 847 additions and 248 deletions
|
@ -104,18 +104,18 @@ public:
|
|||
operator int () const throw(WrongType);
|
||||
operator double () const throw(WrongType);
|
||||
operator char const* () const throw(WrongType);
|
||||
void SetValue(std::string const& in,Etype _type = V_CURRENT) throw(WrongType);
|
||||
bool SetValue(std::string const& in,Etype _type = V_CURRENT) throw(WrongType);
|
||||
std::string ToString() const;
|
||||
|
||||
private:
|
||||
void destroy() throw();
|
||||
Value& copy(Value const& in) throw(WrongType);
|
||||
void plaincopy(Value const& in) throw();
|
||||
void set_hex(std::string const& in);
|
||||
void set_int(std::string const&in);
|
||||
void set_bool(std::string const& in);
|
||||
bool set_hex(std::string const& in);
|
||||
bool set_int(std::string const&in);
|
||||
bool set_bool(std::string const& in);
|
||||
void set_string(std::string const& in);
|
||||
void set_double(std::string const& in);
|
||||
bool set_double(std::string const& in);
|
||||
};
|
||||
|
||||
class Property {
|
||||
|
@ -127,7 +127,7 @@ public:
|
|||
void Set_values(const char * const * in);
|
||||
void Set_help(std::string const& str);
|
||||
char const* Get_help();
|
||||
virtual void SetValue(std::string const& str)=0;
|
||||
virtual bool SetValue(std::string const& str)=0;
|
||||
Value const& GetValue() const { return value;}
|
||||
Value const& Get_Default_Value() const { return default_value; }
|
||||
//CheckValue returns true if value is in suggested_values;
|
||||
|
@ -135,10 +135,12 @@ public:
|
|||
//specific features.
|
||||
virtual bool CheckValue(Value const& in, bool warn);
|
||||
//Set interval value to in or default if in is invalid. force always sets the value.
|
||||
void SetVal(Value const& in, bool forced,bool warn=true) {if(forced || CheckValue(in,warn)) value = in; else value = default_value;}
|
||||
bool SetVal(Value const& in, bool forced,bool warn=true) {
|
||||
if(forced || CheckValue(in,warn)) {value = in; return true;} else { value = default_value; return false;}}
|
||||
virtual ~Property(){ }
|
||||
virtual const std::vector<Value>& GetValues() const;
|
||||
Value::Etype Get_type(){return default_value.type;}
|
||||
Changeable::Value getChange() {return change;}
|
||||
|
||||
protected:
|
||||
Value value;
|
||||
|
@ -161,8 +163,10 @@ public:
|
|||
min = _min;
|
||||
max = _max;
|
||||
}
|
||||
int getMin() { return min;}
|
||||
int getMax() { return max;}
|
||||
void SetMinMax(Value const& min,Value const& max) {this->min = min; this->max=max;}
|
||||
void SetValue(std::string const& in);
|
||||
bool SetValue(std::string const& in);
|
||||
~Prop_int(){ }
|
||||
virtual bool CheckValue(Value const& in, bool warn);
|
||||
private:
|
||||
|
@ -175,7 +179,7 @@ public:
|
|||
:Property(_propname,when){
|
||||
default_value = value = _value;
|
||||
}
|
||||
void SetValue(std::string const& input);
|
||||
bool SetValue(std::string const& input);
|
||||
~Prop_double(){ }
|
||||
};
|
||||
|
||||
|
@ -185,7 +189,7 @@ public:
|
|||
:Property(_propname,when) {
|
||||
default_value = value = _value;
|
||||
}
|
||||
void SetValue(std::string const& in);
|
||||
bool SetValue(std::string const& in);
|
||||
~Prop_bool(){ }
|
||||
};
|
||||
|
||||
|
@ -195,7 +199,7 @@ public:
|
|||
:Property(_propname,when) {
|
||||
default_value = value = _value;
|
||||
}
|
||||
void SetValue(std::string const& in);
|
||||
bool SetValue(std::string const& in);
|
||||
virtual bool CheckValue(Value const& in, bool warn);
|
||||
~Prop_string(){ }
|
||||
};
|
||||
|
@ -207,7 +211,7 @@ public:
|
|||
default_value = value = _value;
|
||||
realpath = _value;
|
||||
}
|
||||
void SetValue(std::string const& in);
|
||||
bool SetValue(std::string const& in);
|
||||
~Prop_path(){ }
|
||||
};
|
||||
|
||||
|
@ -217,7 +221,7 @@ public:
|
|||
:Property(_propname,when) {
|
||||
default_value = value = _value;
|
||||
}
|
||||
void SetValue(std::string const& in);
|
||||
bool SetValue(std::string const& in);
|
||||
~Prop_hex(){ }
|
||||
};
|
||||
|
||||
|
@ -248,7 +252,7 @@ public:
|
|||
const char* GetName() const {return sectionname.c_str();}
|
||||
|
||||
virtual std::string GetPropValue(std::string const& _property) const =0;
|
||||
virtual void HandleInputline(std::string const& _line)=0;
|
||||
virtual bool HandleInputline(std::string const& _line)=0;
|
||||
virtual void PrintData(FILE* outfile) const =0;
|
||||
virtual ~Section() { /*Children must call executedestroy ! */}
|
||||
};
|
||||
|
@ -281,7 +285,7 @@ public:
|
|||
Prop_path* Get_path(std::string const& _propname) const;
|
||||
Prop_multival* Get_multival(std::string const& _propname) const;
|
||||
Prop_multival_remain* Get_multivalremain(std::string const& _propname) const;
|
||||
void HandleInputline(std::string const& gegevens);
|
||||
bool HandleInputline(std::string const& gegevens);
|
||||
void PrintData(FILE* outfile) const;
|
||||
virtual std::string GetPropValue(std::string const& _property) const;
|
||||
//ExecuteDestroy should be here else the destroy functions use destroyed properties
|
||||
|
@ -299,7 +303,7 @@ public:
|
|||
}
|
||||
Section_prop *GetSection() { return section; }
|
||||
const Section_prop *GetSection() const { return section; }
|
||||
virtual void SetValue(std::string const& input);
|
||||
virtual bool SetValue(std::string const& input);
|
||||
virtual const std::vector<Value>& GetValues() const;
|
||||
~Prop_multival() { delete section; }
|
||||
}; //value bevat totale string. setvalue zet elk van de sub properties en checked die.
|
||||
|
@ -308,7 +312,7 @@ class Prop_multival_remain:public Prop_multival{
|
|||
public:
|
||||
Prop_multival_remain(std::string const& _propname, Changeable::Value when,std::string const& sep):Prop_multival(_propname,when,sep){ }
|
||||
|
||||
virtual void SetValue(std::string const& input);
|
||||
virtual bool SetValue(std::string const& input);
|
||||
};
|
||||
|
||||
|
||||
|
@ -316,7 +320,7 @@ class Section_line: public Section{
|
|||
public:
|
||||
Section_line(std::string const& _sectionname):Section(_sectionname){}
|
||||
~Section_line(){ExecuteDestroy(true);}
|
||||
void HandleInputline(std::string const& gegevens);
|
||||
bool HandleInputline(std::string const& gegevens);
|
||||
void PrintData(FILE* outfile) const;
|
||||
virtual std::string GetPropValue(std::string const& _property) const;
|
||||
std::string data;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue