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 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 122 of file config_params.h.

Constructor & Destructor Documentation

◆ PARAM_CFG_INT() [1/2]

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 143 of file config_params.cpp.

144  :
145  PARAM_CFG( ident, PARAM_INT, group, legacy )
146 {
147  m_Pt_param = ptparam;
148  m_Default = default_val;
149  m_Min = min;
150  m_Max = max;
151 }
int m_Default
The default value of the parameter.
int * m_Pt_param
Pointer to the parameter value.
PARAM_CFG(const wxString &ident, const paramcfg_id type, const wxChar *group=NULL, const wxString &legacy_ident=wxEmptyString)
int m_Max
Minimum and maximum values of the param type.

References m_Default, m_Max, m_Min, and m_Pt_param.

◆ PARAM_CFG_INT() [2/2]

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 154 of file config_params.cpp.

155  :
156  PARAM_CFG( ident, PARAM_INT, group, legacy )
157 {
158  m_Pt_param = ptparam;
159  m_Default = default_val;
160  m_Min = min;
161  m_Max = max;
162  m_Setup = setup;
163 }
bool m_Setup
Install or Project based parameter, true == install.
Definition: config_params.h:91
int m_Default
The default value of the parameter.
int * m_Pt_param
Pointer to the parameter value.
PARAM_CFG(const wxString &ident, const paramcfg_id type, const wxChar *group=NULL, const wxString &legacy_ident=wxEmptyString)
int m_Max
Minimum and maximum values of the param type.

References m_Default, m_Max, m_Min, m_Pt_param, and PARAM_CFG::m_Setup.

Member Function Documentation

◆ ReadParam()

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.

Reimplemented in PARAM_CFG_INT_WITH_SCALE.

Definition at line 166 of file config_params.cpp.

167 {
168  if( !m_Pt_param || !aConfig )
169  return;
170 
171  int itmp = m_Default;
172 
173  if( !aConfig->Read( m_Ident, &itmp ) && m_Ident_legacy != wxEmptyString )
174  aConfig->Read( m_Ident_legacy, &itmp );
175 
176  if( (itmp < m_Min) || (itmp > m_Max) )
177  itmp = m_Default;
178 
179  *m_Pt_param = itmp;
180 }
wxString m_Ident
Keyword in config data.
Definition: config_params.h:88
int m_Default
The default value of the parameter.
wxString m_Ident_legacy
Definition: config_params.h:95
int * m_Pt_param
Pointer to the parameter value.
int m_Max
Minimum and maximum values of the param type.

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

◆ SaveParam()

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.

Reimplemented in PARAM_CFG_INT_WITH_SCALE.

Definition at line 183 of file config_params.cpp.

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

References PARAM_CFG::m_Ident, and m_Pt_param.

Member Data Documentation

◆ m_Default

int PARAM_CFG_INT::m_Default

The default value of the parameter.

Definition at line 127 of file config_params.h.

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

◆ m_Group

wxString PARAM_CFG::m_Group
inherited

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

Definition at line 90 of file config_params.h.

Referenced by PARAM_CFG::PARAM_CFG().

◆ m_Ident

◆ m_Ident_legacy

wxString PARAM_CFG::m_Ident_legacy
inherited

◆ m_Max

int PARAM_CFG_INT::m_Max

Minimum and maximum values of the param type.

Definition at line 126 of file config_params.h.

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

◆ m_Min

int PARAM_CFG_INT::m_Min

Definition at line 126 of file config_params.h.

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

◆ m_Pt_param

int* PARAM_CFG_INT::m_Pt_param

Pointer to the parameter value.

Definition at line 125 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().

◆ m_Setup

bool PARAM_CFG::m_Setup
inherited

◆ m_Type

paramcfg_id PARAM_CFG::m_Type
inherited

Type of parameter.

Definition at line 89 of file config_params.h.

Referenced by dumpParamCfg(), PARAM_CFG::PARAM_CFG(), and PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE().


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