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 (const JSON_SETTINGS &aSettings, bool aResetIfMissing=true) const override
 Loads the value of this parameter from JSON to the underlying storage.
 
void Store (JSON_SETTINGS *aSettings) const override
 Stores the value of this parameter to the given JSON_SETTINGS object.
 
nlohmann::json GetDefault () const
 
void SetDefault () override
 
bool MatchesFile (const JSON_SETTINGS &aSettings) const override
 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)
 

Static Public Member Functions

static void MigrateToV9Layers (nlohmann::json &aJson)
 

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.
 

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 188 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 29 of file board_project_settings.cpp.

Member Function Documentation

◆ ClearUnknownKeys()

bool PARAM_BASE::ClearUnknownKeys ( ) const
inlineinherited
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.

◆ GetDefault()

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

Definition at line 339 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 72 of file parameters.h.

◆ jsonToPresets()

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

◆ Load()

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

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 307 of file parameters.h.

◆ MatchesFile()

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

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 349 of file parameters.h.

◆ MigrateToV9Layers()

void PARAM_LAYER_PRESET::MigrateToV9Layers ( nlohmann::json &  aJson)
static

◆ presetsToJson()

nlohmann::json PARAM_LAYER_PRESET::presetsToJson ( )
private

Definition at line 41 of file board_project_settings.cpp.

References m_presets.

◆ SetClearUnknownKeys()

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

Definition at line 80 of file parameters.h.

◆ SetDefault()

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

Implements PARAM_BASE.

Definition at line 344 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 328 of file parameters.h.

Member Data Documentation

◆ m_clearUnknownKeys

bool PARAM_BASE::m_clearUnknownKeys
protectedinherited

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_default

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

Definition at line 367 of file parameters.h.

◆ m_getter

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

Definition at line 368 of file parameters.h.

◆ m_path

◆ m_presets

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

Definition at line 200 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 369 of file parameters.h.


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