31 #include <wx/config.h> 36 const wxString& aGroup )
42 if( !!param->m_Group )
43 aCfg->SetPath( param->m_Group );
45 aCfg->SetPath( aGroup );
50 param->ReadParam( aCfg );
64 param->ReadParam( aCfg );
70 const wxString& aGroup )
76 if( !!param->m_Group )
77 aCfg->SetPath( param->m_Group );
79 aCfg->SetPath( aGroup );
86 if( !!param->m_Ident )
87 aCfg->DeleteGroup( param->m_Ident );
91 param->SaveParam( aCfg );
103 if( !param->m_Setup )
108 if( !!param->m_Ident )
109 aCfg->DeleteGroup( param->m_Ident );
113 param->SaveParam( aCfg );
127 aConfig->Write( aKey, tnumber );
132 const wxChar* group,
const wxString& legacy )
144 int min,
int max,
const wxChar* group,
const wxString& legacy ) :
155 int min,
int max,
const wxChar* group,
const wxString& legacy ) :
193 int default_val,
int min,
int max,
194 const wxChar* group,
double aBiu2cfgunit,
195 const wxString& legacy_ident ) :
196 PARAM_CFG_INT( ident, ptparam, default_val, min, max, group, legacy_ident )
204 int default_val,
int min,
int max,
205 const wxChar* group,
double aBiu2cfgunit,
206 const wxString& legacy_ident ) :
207 PARAM_CFG_INT( setup, ident, ptparam, default_val, min, max, group, legacy_ident )
246 double default_val,
double min,
double max,
247 const wxChar* group ) :
258 const wxString& ident,
263 const wxChar* group ) :
280 aConfig->Read(
m_Ident, &dtmp );
303 const wxChar* group,
const wxString& legacy ) :
312 int default_val,
const wxChar* group,
const wxString& legacy ) :
345 const wxChar* group ) :
353 const wxString& default_val,
const wxChar* group ) :
381 const wxChar* group ) :
389 std::set<wxString>* ptparam,
const wxChar* group ) :
402 for(
int i = 1;
true; ++i )
408 data = aConfig->Read( key, wxT(
"" ) );
432 aConfig->Write( key, str );
439 const wxChar* group ) :
451 wxString prm = aConfig->Read(
m_Ident );
456 prm.Replace(wxT(
"/"), wxT(
"\\"));
469 prm.Replace(wxT(
"\\"), wxT(
"/") );
470 aConfig->Write(
m_Ident, prm );
475 wxArrayString* ptparam,
476 const wxChar* group ) :
490 wxString libname, id_lib;
498 libname = aConfig->Read( id_lib, wxT(
"" ) );
500 if( libname.IsEmpty() )
506 libname.Replace(wxT(
"/"), wxT(
"\\"));
508 libname_list->Add( libname );
523 for(
unsigned indexlib = 0; indexlib < libname_list->GetCount(); indexlib++ )
528 configkey << (indexlib + 1);
529 libname = libname_list->Item( indexlib );
532 libname.Replace(wxT(
"\\"), wxT(
"/") );
533 aConfig->Write( configkey, libname );
PARAM_CFG_DOUBLE(const wxString &ident, double *ptparam, double default_val=0.0, double min=0.0, double max=10000.0, const wxChar *group=nullptr)
bool m_Setup
Install or Project based parameter, true == install.
virtual void SaveParam(wxConfigBase *aConfig) const override
Save the value of the parameter stored in aConfig.
PARAM_CFG_WXSTRING_SET(const wxString &ident, std::set< wxString > *ptparam, const wxChar *group=nullptr)
wxString m_Group
Group name (this is like a path in the config data)
int m_Default
The default value of the parameter.
wxString * m_Pt_param
Pointer to the parameter value.
virtual void ReadParam(wxConfigBase *aConfig) const override
Read the value of the parameter stored in aConfig.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
wxString m_default
The default value of the parameter.
void wxConfigLoadParams(wxConfigBase *aCfg, const std::vector< PARAM_CFG * > &aList, const wxString &aGroup)
Use aList of PARAM_CFG objects to load configuration values from aCfg.
void wxConfigLoadSetups(wxConfigBase *aCfg, const std::vector< PARAM_CFG * > &aList)
Use aList of PARAM_CFG object to load configuration values from aCfg.
virtual void SaveParam(wxConfigBase *aConfig) const override
Save the value of the parameter stored in aConfig.
wxString m_Ident
Keyword in config data.
int m_Default
The default value of the parameter.
virtual void SaveParam(wxConfigBase *aConfig) const override
Save the value of the parameter stored in aConfig.
virtual void ReadParam(wxConfigBase *aConfig) const override
Read the value of the parameter stored in aConfig.
double * m_Pt_param
Pointer to the parameter value.
int * m_Pt_param
Pointer to the parameter value.
PARAM_CFG(const wxString &ident, const paramcfg_id type, const wxChar *group=nullptr, const wxString &legacy_ident=wxEmptyString)
void wxConfigSaveSetups(wxConfigBase *aCfg, const std::vector< PARAM_CFG * > &aList)
Writes aList of PARAM_CFG objects to aCfg.
double m_BIU_to_cfgunit
the factor to convert the saved value in internal value
std::set< wxString > * m_Pt_param
Pointer to the parameter value.
PARAM_CFG_INT_WITH_SCALE(const wxString &ident, int *ptparam, int default_val=0, int min=std::numeric_limits< int >::min(), int max=std::numeric_limits< int >::max(), const wxChar *group=nullptr, double aBiu2cfgunit=1.0, const wxString &legacy_ident=wxEmptyString)
wxArrayString * m_Pt_param
Pointer to the parameter value.
virtual void ReadParam(wxConfigBase *aConfig) const override
Read the value of the parameter stored in aConfig.
virtual void SaveParam(wxConfigBase *aConfig) const override
Save the value of the parameter stored in aConfig.
Configuration object for integers.
int m_Max
Minimum and maximum values of the param type.
virtual void SaveParam(wxConfigBase *aConfig) const override
Save the value of the parameter stored in aConfig.
double m_Max
Minimum and maximum values of the param type.
paramcfg_id
Type of parameter in the configuration file.
virtual void SaveParam(wxConfigBase *aConfig) const override
Save the value of the parameter stored in aConfig.
double m_Default
The default value of the parameter.
PARAM_CFG_INT(const wxString &ident, int *ptparam, int default_val=0, int min=std::numeric_limits< int >::min(), int max=std::numeric_limits< int >::max(), const wxChar *group=nullptr, const wxString &legacy_ident=wxEmptyString)
bool * m_Pt_param
Pointer to the parameter value.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
virtual void SaveParam(wxConfigBase *aConfig) const override
Save the value of the parameter stored in aConfig.
void ConfigBaseWriteDouble(wxConfigBase *aConfig, const wxString &aKey, double aValue)
A helper function to write doubles in configuration file.
virtual void ReadParam(wxConfigBase *aConfig) const override
Read the value of the parameter stored in aConfig.
virtual void ReadParam(wxConfigBase *aConfig) const override
Read the value of the parameter stored in aConfig.
PARAM_CFG_BOOL(const wxString &ident, bool *ptparam, int default_val=false, const wxChar *group=nullptr, const wxString &legacy_ident=wxEmptyString)
A base class which establishes the interface functions ReadParam and SaveParam, which are implemented...
PARAM_CFG_LIBNAME_LIST(const wxChar *ident, wxArrayString *ptparam, const wxChar *group=nullptr)
paramcfg_id m_Type
Type of parameter.
void wxConfigSaveParams(wxConfigBase *aCfg, const std::vector< PARAM_CFG * > &aList, const wxString &aGroup)
Write aList of PARAM_CFG objects aCfg.
wxString * m_Pt_param
Pointer to the parameter value.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
virtual void ReadParam(wxConfigBase *aConfig) const override
Read the value of the parameter stored in aConfig.
virtual void ReadParam(wxConfigBase *aConfig) const override
Read the value of the parameter stored in aConfig.
PARAM_CFG_WXSTRING(const wxString &ident, wxString *ptparam, const wxChar *group=nullptr)
virtual void ReadParam(wxConfigBase *aConfig) const override
Read the value of the parameter stored in aConfig.
virtual void SaveParam(wxConfigBase *aConfig) const override
Save the value of the parameter stored in aConfig.
PARAM_CFG_FILENAME(const wxString &ident, wxString *ptparam, const wxChar *group=nullptr)