KiCad PCB EDA Suite
PARAM_BASE Class Referenceabstract

#include <parameters.h>

Inheritance diagram for PARAM_BASE:
COLOR_MAP_PARAM PARAM< ValueType > PARAM< wxString > PARAM_ENUM< EnumType > PARAM_LAMBDA< ValueType > PARAM_LAMBDA< nlohmann::json > PARAM_LIST< Type > PARAM_LIST< wxString > PARAM_MAP< Value > PARAM_SCALED< ValueType > PARAM_WXSTRING_MAP

Public Member Functions

 PARAM_BASE (std::string aJsonPath, bool aReadOnly)
 
virtual ~PARAM_BASE ()=default
 
virtual void Load (JSON_SETTINGS *aSettings, bool aResetIfMissing=true) const =0
 Loads the value of this parameter from JSON to the underlying storage. More...
 
virtual void Store (JSON_SETTINGS *aSettings) const =0
 Stores the value of this parameter to the given JSON_SETTINGS object. More...
 
virtual void SetDefault ()=0
 
virtual bool IsDefault () const =0
 Checks whether or not this param has been changed from its default value. More...
 
virtual bool MatchesFile (JSON_SETTINGS *aSettings) const =0
 Checks whether the parameter in memory matches the one in a given JSON file. More...
 
const std::string & GetJsonPath ()
 

Protected Attributes

std::string m_path
 the string used to store the param in json files More...
 
bool m_readOnly
 ! True if the parameter pointer should never be overwritten More...
 

Detailed Description

Definition at line 32 of file parameters.h.

Constructor & Destructor Documentation

◆ PARAM_BASE()

PARAM_BASE::PARAM_BASE ( std::string  aJsonPath,
bool  aReadOnly 
)
inline

Definition at line 35 of file parameters.h.

35  :
36  m_path( std::move( aJsonPath ) ),
37  m_readOnly( aReadOnly )
38  {}
std::string m_path
the string used to store the param in json files
Definition: parameters.h:80
bool m_readOnly
! True if the parameter pointer should never be overwritten
Definition: parameters.h:83

◆ ~PARAM_BASE()

virtual PARAM_BASE::~PARAM_BASE ( )
virtualdefault

Member Function Documentation

◆ GetJsonPath()

const std::string& PARAM_BASE::GetJsonPath ( )
inline
Returns
the path name of the parameter used to store it in the json file mainly usefull in error messages

Definition at line 74 of file parameters.h.

74 { return m_path; }
std::string m_path
the string used to store the param in json files
Definition: parameters.h:80

References m_path.

◆ IsDefault()

virtual bool PARAM_BASE::IsDefault ( ) const
pure virtual

Checks whether or not this param has been changed from its default value.

Returns
true if the parameter in memory matches its default value

Implemented in PARAM_WXSTRING_MAP, PARAM_MAP< Value >, PARAM_LIST< Type >, PARAM_LIST< wxString >, PARAM_SCALED< ValueType >, PARAM_LAMBDA< ValueType >, PARAM_LAMBDA< nlohmann::json >, PARAM_ENUM< EnumType >, COLOR_MAP_PARAM, PARAM< ValueType >, and PARAM< wxString >.

◆ Load()

virtual void PARAM_BASE::Load ( JSON_SETTINGS aSettings,
bool  aResetIfMissing = true 
) const
pure virtual

Loads the value of this parameter from JSON to the underlying storage.

Parameters
aSettingsis the JSON_SETTINGS object to load from.
aResetIfMissingif true will set the parameter to its default value if load fails

Implemented in PARAM_WXSTRING_MAP, PARAM_MAP< Value >, PARAM_PATH_LIST, PARAM_LIST< Type >, PARAM_LIST< wxString >, PARAM_SCALED< ValueType >, PARAM_LAMBDA< ValueType >, PARAM_LAMBDA< nlohmann::json >, PARAM_ENUM< EnumType >, PARAM_PATH, COLOR_MAP_PARAM, PARAM< ValueType >, and PARAM< wxString >.

◆ MatchesFile()

virtual bool PARAM_BASE::MatchesFile ( JSON_SETTINGS aSettings) const
pure virtual

Checks whether the parameter in memory matches the one in a given JSON file.

Parameters
aSettingsis a JSON_SETTINGS to check the JSON file contents of
Returns
true if the parameter in memory matches its value in the file

Implemented in PARAM_WXSTRING_MAP, PARAM_MAP< Value >, PARAM_PATH_LIST, PARAM_LIST< Type >, PARAM_LIST< wxString >, PARAM_SCALED< ValueType >, PARAM_LAMBDA< ValueType >, PARAM_LAMBDA< nlohmann::json >, PARAM_ENUM< EnumType >, PARAM_PATH, COLOR_MAP_PARAM, PARAM< ValueType >, and PARAM< wxString >.

◆ SetDefault()

◆ Store()

virtual void PARAM_BASE::Store ( JSON_SETTINGS aSettings) const
pure virtual

Member Data Documentation

◆ m_path

◆ m_readOnly


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