KiCad PCB EDA Suite
PARAM_CFG_INT Class Reference

Configuration parameter - Integer Class. More...

#include <config_params.h>

Inheritance diagram for PARAM_CFG_INT:
PARAM_CFG_BASE PARAM_CFG_INT_WITH_SCALE

Public Member Functions

 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)
 
 PARAM_CFG_INT (bool Insetup, 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)
 
virtual void ReadParam (wxConfigBase *aConfig) const override
 Function ReadParam reads the value of the parameter stored in aConfig. More...
 
virtual void SaveParam (wxConfigBase *aConfig) const override
 Function SaveParam saves the value of the parameter stored in aConfig. More...
 

Public Attributes

int * m_Pt_param
 Pointer to the parameter value. More...
 
int m_Min
 
int m_Max
 Minimum and maximum values of the param type. More...
 
int m_Default
 The default value of the parameter. More...
 
wxString m_Ident
 Keyword in config data. More...
 
paramcfg_id m_Type
 Type of parameter. More...
 
wxString m_Group
 Group name (this is like a path in the config data) More...
 
bool m_Setup
 Install or Project based parameter, true == install. More...
 
wxString m_Ident_legacy
 

Detailed Description

Configuration parameter - Integer Class.

Definition at line 136 of file config_params.h.

Constructor & Destructor Documentation

PARAM_CFG_INT::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 
)

Definition at line 149 of file config_params.cpp.

References m_Default, m_Max, m_Min, m_Pt_param, max, and min.

150  :
151  PARAM_CFG_BASE( ident, PARAM_INT, group, legacy )
152 {
153  m_Pt_param = ptparam;
154  m_Default = default_val;
155  m_Min = min;
156  m_Max = max;
157 }
int m_Default
The default value of the parameter.
PARAM_CFG_BASE(const wxString &ident, const paramcfg_id type, const wxChar *group=NULL, const wxString &legacy_ident=wxEmptyString)
int * m_Pt_param
Pointer to the parameter value.
int m_Max
Minimum and maximum values of the param type.
#define max(a, b)
Definition: auxiliary.h:86
#define min(a, b)
Definition: auxiliary.h:85
PARAM_CFG_INT::PARAM_CFG_INT ( bool  Insetup,
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 
)

Definition at line 160 of file config_params.cpp.

References m_Default, m_Max, m_Min, m_Pt_param, PARAM_CFG_BASE::m_Setup, max, and min.

161  :
162  PARAM_CFG_BASE( ident, PARAM_INT, group, legacy )
163 {
164  m_Pt_param = ptparam;
165  m_Default = default_val;
166  m_Min = min;
167  m_Max = max;
168  m_Setup = setup;
169 }
int m_Default
The default value of the parameter.
PARAM_CFG_BASE(const wxString &ident, const paramcfg_id type, const wxChar *group=NULL, const wxString &legacy_ident=wxEmptyString)
int * m_Pt_param
Pointer to the parameter value.
bool m_Setup
Install or Project based parameter, true == install.
int m_Max
Minimum and maximum values of the param type.
#define max(a, b)
Definition: auxiliary.h:86
#define min(a, b)
Definition: auxiliary.h:85

Member Function Documentation

void PARAM_CFG_INT::ReadParam ( wxConfigBase *  aConfig) const
overridevirtual

Function ReadParam reads the value of the parameter stored in aConfig.

Parameters
aConfig= the wxConfigBase that holds the parameter

Reimplemented from PARAM_CFG_BASE.

Reimplemented in PARAM_CFG_INT_WITH_SCALE.

Definition at line 172 of file config_params.cpp.

References m_Default, PARAM_CFG_BASE::m_Ident, PARAM_CFG_BASE::m_Ident_legacy, m_Max, m_Min, and m_Pt_param.

173 {
174  if( !m_Pt_param || !aConfig )
175  return;
176 
177  int itmp = m_Default;
178 
179  if( !aConfig->Read( m_Ident, &itmp ) && m_Ident_legacy != wxEmptyString )
180  aConfig->Read( m_Ident_legacy, &itmp );
181 
182  if( (itmp < m_Min) || (itmp > m_Max) )
183  itmp = m_Default;
184 
185  *m_Pt_param = itmp;
186 }
wxString m_Ident_legacy
int m_Default
The default value of the parameter.
int * m_Pt_param
Pointer to the parameter value.
int m_Max
Minimum and maximum values of the param type.
wxString m_Ident
Keyword in config data.
void PARAM_CFG_INT::SaveParam ( wxConfigBase *  aConfig) const
overridevirtual

Function SaveParam saves the value of the parameter stored in aConfig.

Parameters
aConfig= the wxConfigBase that can store the parameter

Reimplemented from PARAM_CFG_BASE.

Reimplemented in PARAM_CFG_INT_WITH_SCALE.

Definition at line 189 of file config_params.cpp.

References PARAM_CFG_BASE::m_Ident, and m_Pt_param.

190 {
191  if( !m_Pt_param || !aConfig )
192  return;
193 
194  aConfig->Write( m_Ident, *m_Pt_param );
195 }
int * m_Pt_param
Pointer to the parameter value.
wxString m_Ident
Keyword in config data.

Member Data Documentation

int PARAM_CFG_INT::m_Default

The default value of the parameter.

Definition at line 141 of file config_params.h.

Referenced by PARAM_CFG_INT(), ReadParam(), and PARAM_CFG_INT_WITH_SCALE::ReadParam().

wxString PARAM_CFG_BASE::m_Group
inherited

Group name (this is like a path in the config data)

Definition at line 104 of file config_params.h.

Referenced by PARAM_CFG_BASE::PARAM_CFG_BASE().

wxString PARAM_CFG_BASE::m_Ident_legacy
inherited
int PARAM_CFG_INT::m_Max

Minimum and maximum values of the param type.

Definition at line 140 of file config_params.h.

Referenced by PARAM_CFG_INT(), ReadParam(), and PARAM_CFG_INT_WITH_SCALE::ReadParam().

int PARAM_CFG_INT::m_Min

Definition at line 140 of file config_params.h.

Referenced by PARAM_CFG_INT(), ReadParam(), and PARAM_CFG_INT_WITH_SCALE::ReadParam().

int* PARAM_CFG_INT::m_Pt_param

Pointer to the parameter value.

Definition at line 139 of file config_params.h.

Referenced by PARAM_CFG_INT(), ReadParam(), PARAM_CFG_INT_WITH_SCALE::ReadParam(), SaveParam(), and PARAM_CFG_INT_WITH_SCALE::SaveParam().

bool PARAM_CFG_BASE::m_Setup
inherited
paramcfg_id PARAM_CFG_BASE::m_Type
inherited

Type of parameter.

Definition at line 103 of file config_params.h.

Referenced by PARAM_CFG_BASE::PARAM_CFG_BASE(), and PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE().


The documentation for this class was generated from the following files: