KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PARAM_BASE Class Referenceabstract

#include <parameters.h>

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

Public Member Functions

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

Protected Attributes

std::string m_path
 Address of the param in the json files.
 
bool m_readOnly
 Indicates param pointer should never be overwritten.
 
bool m_clearUnknownKeys
 Keys should be cleared from source rather than merged.
 

Detailed Description

Definition at line 35 of file parameters.h.

Constructor & Destructor Documentation

◆ PARAM_BASE()

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

Definition at line 38 of file parameters.h.

◆ ~PARAM_BASE()

virtual PARAM_BASE::~PARAM_BASE ( )
virtualdefault

Member Function Documentation

◆ ClearUnknownKeys()

bool PARAM_BASE::ClearUnknownKeys ( ) const
inline
Returns
true if keys should be cleared from source file rather than merged. Useful for things such as text variables that are semantically an array but stored as a map.

Definition at line 78 of file parameters.h.

◆ GetJsonPath()

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

Definition at line 72 of file parameters.h.

◆ Load()

virtual void PARAM_BASE::Load ( const 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 COLOR_MAP_PARAM, PARAM< ValueType >, PARAM< wxString >, PARAM_PATH, PARAM_ENUM< EnumType >, PARAM_LAMBDA< ValueType >, PARAM_LAMBDA< nlohmann::json >, PARAM_SCALED< ValueType >, PARAM_LIST< Type >, PARAM_LIST< wxString >, PARAM_SET< Type >, PARAM_PATH_LIST, PARAM_MAP< Value >, and PARAM_WXSTRING_MAP.

◆ MatchesFile()

virtual bool PARAM_BASE::MatchesFile ( const 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 COLOR_MAP_PARAM, PARAM< ValueType >, PARAM< wxString >, PARAM_PATH, PARAM_ENUM< EnumType >, PARAM_LAMBDA< ValueType >, PARAM_LAMBDA< nlohmann::json >, PARAM_SCALED< ValueType >, PARAM_LIST< Type >, PARAM_LIST< wxString >, PARAM_SET< Type >, PARAM_PATH_LIST, PARAM_MAP< Value >, and PARAM_WXSTRING_MAP.

◆ SetClearUnknownKeys()

void PARAM_BASE::SetClearUnknownKeys ( bool  aSet = true)
inline

Definition at line 80 of file parameters.h.

◆ SetDefault()

◆ Store()

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

Member Data Documentation

◆ m_clearUnknownKeys

bool PARAM_BASE::m_clearUnknownKeys
protected

Keys should be cleared from source rather than merged.

This is useful for things that are semantically an array but stored as a map, such as textVars.

Definition at line 85 of file parameters.h.

◆ m_path

◆ m_readOnly

bool PARAM_BASE::m_readOnly
protected

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