KiCad PCB EDA Suite
PARAM_CFG_FIELDNAMES Class Reference

#include <eeschema_config.h>

Inheritance diagram for PARAM_CFG_FIELDNAMES:
PARAM_CFG

Public Member Functions

 PARAM_CFG_FIELDNAMES (TEMPLATES *ptparam, const wxChar *group=nullptr)
 
void ReadParam (wxConfigBase *aConfig) const override
 Function ReadParam reads the value of the parameter stored in aConfig. More...
 
void SaveParam (wxConfigBase *aConfig) const override
 Function SaveParam saves the value of the parameter stored in aConfig. More...
 

Public Attributes

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
 

Protected Attributes

TEMPLATESm_Pt_param
 Pointer to the parameter value. More...
 

Detailed Description

Definition at line 35 of file eeschema_config.h.

Constructor & Destructor Documentation

◆ PARAM_CFG_FIELDNAMES()

PARAM_CFG_FIELDNAMES::PARAM_CFG_FIELDNAMES ( TEMPLATES ptparam,
const wxChar *  group = nullptr 
)

Definition at line 62 of file eeschema_config.cpp.

62  :
63  PARAM_CFG( wxEmptyString, PARAM_SEVERITIES, group )
64 {
65  m_Pt_param = ptparam;
66 }
PARAM_CFG(const wxString &ident, const paramcfg_id type, const wxChar *group=NULL, const wxString &legacy_ident=wxEmptyString)
TEMPLATES * m_Pt_param
Pointer to the parameter value.

References m_Pt_param.

Member Function Documentation

◆ ReadParam()

void PARAM_CFG_FIELDNAMES::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.

Definition at line 68 of file eeschema_config.cpp.

69 {
70  if( !m_Pt_param || !aConfig )
71  return;
72 
73  wxString templateFieldNames = aConfig->Read( FieldNameTemplatesKey, wxEmptyString );
74 
75  if( !templateFieldNames.IsEmpty() )
76  {
77  TEMPLATE_FIELDNAMES_LEXER lexer( TO_UTF8( templateFieldNames ) );
78 
79  try
80  {
81  m_Pt_param->Parse( &lexer, false );
82  }
83  catch( const IO_ERROR& DBG( e ) )
84  {
85  // @todo show error msg
86  DBG( printf( "templatefieldnames parsing error: '%s'\n", TO_UTF8( e.What() ) ); )
87  }
88  }
89 }
void Parse(TEMPLATE_FIELDNAMES_LEXER *in, bool aGlobal)
Function Parse fills this object from information in the input stream handled by TEMPLATE_FIELDNAMES_...
#define FieldNameTemplatesKey
TEMPLATES * m_Pt_param
Pointer to the parameter value.
#define TO_UTF8(wxstring)
#define DBG(x)
Definition: fctsys.h:33
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76

References DBG, FieldNameTemplatesKey, m_Pt_param, TEMPLATES::Parse(), and TO_UTF8.

Referenced by DIALOG_SCHEMATIC_SETUP::OnAuxiliaryAction().

◆ SaveParam()

void PARAM_CFG_FIELDNAMES::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.

Definition at line 91 of file eeschema_config.cpp.

92 {
93  if( !m_Pt_param || !aConfig )
94  return;
95 
97  m_Pt_param->Format( &sf, 0, false );
98 
99  wxString record = FROM_UTF8( sf.GetString().c_str() );
100  record.Replace( wxT("\n"), wxT(""), true ); // strip all newlines
101  record.Replace( wxT(" "), wxT(" "), true ); // double space to single
102 
103  aConfig->Write( FieldNameTemplatesKey, record );
104 }
void Format(OUTPUTFORMATTER *out, int nestLevel, bool aGlobal) const
Function Format serializes this object out as text into the given OUTPUTFORMATTER.
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:114
#define FieldNameTemplatesKey
const std::string & GetString()
Definition: richio.h:475
TEMPLATES * m_Pt_param
Pointer to the parameter value.
STRING_FORMATTER implements OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:445

References FieldNameTemplatesKey, TEMPLATES::Format(), FROM_UTF8(), STRING_FORMATTER::GetString(), and m_Pt_param.

Member Data Documentation

◆ m_Group

wxString PARAM_CFG::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::PARAM_CFG().

◆ m_Ident

◆ m_Ident_legacy

wxString PARAM_CFG::m_Ident_legacy
inherited

◆ m_Pt_param

TEMPLATES* PARAM_CFG_FIELDNAMES::m_Pt_param
protected

Pointer to the parameter value.

Definition at line 38 of file eeschema_config.h.

Referenced by PARAM_CFG_FIELDNAMES(), ReadParam(), and SaveParam().

◆ m_Setup

◆ m_Type

paramcfg_id PARAM_CFG::m_Type
inherited

Type of parameter.

Definition at line 103 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: