#include <json_settings_internals.h>
|
static nlohmann::json::json_pointer | PointerFromString (std::string aPath) |
| Builds a JSON pointer based on a given string. More...
|
|
Definition at line 27 of file json_settings_internals.h.
◆ JSON_SETTINGS_INTERNALS()
JSON_SETTINGS_INTERNALS::JSON_SETTINGS_INTERNALS |
( |
| ) |
|
|
inline |
◆ At()
nlohmann::json & JSON_SETTINGS_INTERNALS::At |
( |
const std::string & |
aPath | ) |
|
|
inline |
◆ CloneFrom()
Definition at line 71 of file json_settings_internals.h.
72 {
73 nlohmann::json::json_pointer root( "" );
74 this->nlohmann::json::operator[]( root ) = aOther.nlohmann::json::operator[]( root );
75 }
◆ Get()
template<typename ValueType >
ValueType JSON_SETTINGS_INTERNALS::Get |
( |
const std::string & |
aPath | ) |
const |
|
inline |
◆ operator[]() [1/2]
nlohmann::json & JSON_SETTINGS_INTERNALS::operator[] |
( |
const nlohmann::json::json_pointer & |
aPointer | ) |
|
|
inline |
◆ operator[]() [2/2]
nlohmann::json & JSON_SETTINGS_INTERNALS::operator[] |
( |
const std::string & |
aPath | ) |
|
|
inline |
◆ PointerFromString()
nlohmann::json::json_pointer JSON_SETTINGS_INTERNALS::PointerFromString |
( |
std::string |
aPath | ) |
|
|
static |
Builds a JSON pointer based on a given string.
- Parameters
-
aPath | is the path in the form "key1.key2.key3" |
- Returns
- a JSON pointer that can be used to index into a JSON object
Definition at line 44 of file json_settings.cpp.
45{
46 std::replace( aPath.begin(), aPath.end(), '.', '/' );
47 aPath.insert( 0, "/" );
48
49 nlohmann::json::json_pointer p;
50
51 try
52 {
53 p = nlohmann::json::json_pointer( aPath );
54 }
55 catch( ... )
56 {
57 wxASSERT_MSG( false, wxT( "Invalid pointer path in PointerFromString!" ) );
58 }
59
60 return p;
61}
Referenced by At(), JSON_SETTINGS::Contains(), Get(), PCB_CALCULATOR_SETTINGS::MigrateFromLegacy(), operator[](), and JSON_SETTINGS::SetIfPresent().
◆ SetFromString()
template<typename ValueType >
void JSON_SETTINGS_INTERNALS::SetFromString |
( |
const std::string & |
aPath, |
|
|
ValueType |
aVal |
|
) |
| |
|
inline |
◆ JSON_SETTINGS
The documentation for this class was generated from the following files: