KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PARAM_LAYER_PRESET Class Reference

#include <board_project_settings.h>

Inheritance diagram for PARAM_LAYER_PRESET:
PARAM_LAMBDA< nlohmann::json > PARAM_BASE

Public Member Functions

 PARAM_LAYER_PRESET (const std::string &aPath, std::vector< LAYER_PRESET > *aPresetList)
 
void Load (JSON_SETTINGS *aSettings, bool aResetIfMissing=true) const override
 Loads the value of this parameter from JSON to the underlying storage. More...
 
void Store (JSON_SETTINGS *aSettings) const override
 Stores the value of this parameter to the given JSON_SETTINGS object. More...
 
nlohmann::json GetDefault () const
 
void SetDefault () override
 
bool MatchesFile (JSON_SETTINGS *aSettings) const override
 Checks whether the parameter in memory matches the one in a given JSON file. More...
 
const std::string & GetJsonPath () const
 

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...
 

Private Member Functions

nlohmann::json presetsToJson ()
 
void jsonToPresets (const nlohmann::json &aJson)
 

Private Attributes

std::vector< LAYER_PRESET > * m_presets
 
nlohmann::json m_default
 
std::function< nlohmann::json()> m_getter
 
std::function< void(nlohmann::json)> m_setter
 

Detailed Description

Definition at line 187 of file board_project_settings.h.

Constructor & Destructor Documentation

◆ PARAM_LAYER_PRESET()

PARAM_LAYER_PRESET::PARAM_LAYER_PRESET ( const std::string &  aPath,
std::vector< LAYER_PRESET > *  aPresetList 
)

Definition at line 27 of file board_project_settings.cpp.

Member Function Documentation

◆ GetDefault()

nlohmann::json PARAM_LAMBDA< nlohmann::json >::GetDefault ( ) const
inlineinherited

Definition at line 306 of file parameters.h.

◆ GetJsonPath()

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

Definition at line 69 of file parameters.h.

References PARAM_BASE::m_path.

◆ jsonToPresets()

void PARAM_LAYER_PRESET::jsonToPresets ( const nlohmann::json &  aJson)
private

◆ Load()

void PARAM_LAMBDA< nlohmann::json >::Load ( JSON_SETTINGS aSettings,
bool  aResetIfMissing = true 
) const
overridevirtualinherited

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

Implements PARAM_BASE.

Definition at line 293 of file parameters.cpp.

◆ MatchesFile()

bool PARAM_LAMBDA< nlohmann::json >::MatchesFile ( JSON_SETTINGS aSettings) const
overridevirtualinherited

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

Implements PARAM_BASE.

Definition at line 316 of file parameters.cpp.

◆ presetsToJson()

nlohmann::json PARAM_LAYER_PRESET::presetsToJson ( )
private

Definition at line 39 of file board_project_settings.cpp.

References m_presets.

◆ SetDefault()

void PARAM_LAMBDA< nlohmann::json >::SetDefault ( )
inlineoverridevirtualinherited

Implements PARAM_BASE.

Definition at line 311 of file parameters.h.

◆ Store()

void PARAM_LAMBDA< nlohmann::json >::Store ( JSON_SETTINGS aSettings) const
inlineoverridevirtualinherited

Stores the value of this parameter to the given JSON_SETTINGS object.

Parameters
aSettingsis the JSON_SETTINGS object to store into.

Implements PARAM_BASE.

Definition at line 295 of file parameters.h.

Member Data Documentation

◆ m_default

nlohmann::json PARAM_LAMBDA< nlohmann::json >::m_default
privateinherited

Definition at line 319 of file parameters.h.

◆ m_getter

std::function<nlohmann::json ()> PARAM_LAMBDA< nlohmann::json >::m_getter
privateinherited

Definition at line 321 of file parameters.h.

◆ m_path

◆ m_presets

std::vector<LAYER_PRESET>* PARAM_LAYER_PRESET::m_presets
private

Definition at line 197 of file board_project_settings.h.

Referenced by jsonToPresets(), and presetsToJson().

◆ m_readOnly

bool PARAM_BASE::m_readOnly
protectedinherited

◆ m_setter

std::function<void( nlohmann::json )> PARAM_LAMBDA< nlohmann::json >::m_setter
privateinherited

Definition at line 323 of file parameters.h.


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