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=NULL)
 
 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=NULL)
 
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...
 

Detailed Description

Configuration parameter - Integer Class.

Definition at line 127 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 = NULL 
)

Definition at line 147 of file config_params.cpp.

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

149  :
150  PARAM_CFG_BASE( ident, PARAM_INT, group )
151 {
152  m_Pt_param = ptparam;
153  m_Default = default_val;
154  m_Min = min;
155  m_Max = max;
156 }
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.
#define max(a, b)
Definition: auxiliary.h:86
PARAM_CFG_BASE(const wxString &ident, const paramcfg_id type, const wxChar *group=NULL)
#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 = NULL 
)

Definition at line 159 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 )
163 {
164  m_Pt_param = ptparam;
165  m_Default = default_val;
166  m_Min = min;
167  m_Max = max;
168  m_Setup = Insetup;
169 }
int m_Default
The default value of the parameter.
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
PARAM_CFG_BASE(const wxString &ident, const paramcfg_id type, const wxChar *group=NULL)
#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, m_Max, m_Min, and m_Pt_param.

173 {
174  if( !m_Pt_param || !aConfig )
175  return;
176 
177  int itmp = aConfig->Read( m_Ident, m_Default );
178 
179  if( (itmp < m_Min) || (itmp > m_Max) )
180  itmp = m_Default;
181 
182  *m_Pt_param = itmp;
183 }
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.
Definition: config_params.h:97
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 186 of file config_params.cpp.

References PARAM_CFG_BASE::m_Ident, and m_Pt_param.

187 {
188  if( !m_Pt_param || !aConfig )
189  return;
190 
191  aConfig->Write( m_Ident, *m_Pt_param );
192 }
int * m_Pt_param
Pointer to the parameter value.
wxString m_Ident
Keyword in config data.
Definition: config_params.h:97

Member Data Documentation

int PARAM_CFG_INT::m_Default

The default value of the parameter.

Definition at line 132 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 99 of file config_params.h.

Referenced by PARAM_CFG_BASE::PARAM_CFG_BASE().

int PARAM_CFG_INT::m_Max

Minimum and maximum values of the param type.

Definition at line 131 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 131 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 130 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 98 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: