smartmontools SVN Rev 5602
Utility to control and monitor storage systems with "S.M.A.R.T."
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
json::ref Class Reference

Reference to a JSON element. More...

#include <json.h>

Collaboration diagram for json::ref:
Collaboration graph
[legend]

Public Member Functions

 ~ref ()
 
ref operator[] (const char *keystr) const
 Return reference to object element.
 
ref operator[] (const std::string &keystr) const
 Return reference to object element (std::string variant).
 
ref operator[] (int index) const
 Return reference to array element.
 
void operator= (bool value)
 
void operator= (int value)
 
void operator= (unsigned value)
 
void operator= (long value)
 
void operator= (unsigned long value)
 
void operator= (long long value)
 
void operator= (unsigned long long value)
 
void operator= (const char *value)
 
void operator= (const std::string &value)
 
ref with_suffix (const char *key_suffix) const
 Return reference to element with KEY_SUFFIX appended to last key.
 
void set_uint128 (uint64_t value_hi, uint64_t value_lo)
 
bool set_if_safe_uint64 (uint64_t value)
 
bool set_if_safe_uint128 (uint64_t value_hi, uint64_t value_lo)
 
bool set_if_safe_le128 (const void *pvalue)
 
void set_unsafe_uint64 (uint64_t value)
 
void set_unsafe_uint128 (uint64_t value_hi, uint64_t value_lo)
 
void set_unsafe_le128 (const void *pvalue)
 
void operator+= (std::initializer_list< initlist_key_value_pair > ilist)
 Braced-init-list support for nested objects.
 
void operator+= (std::initializer_list< initlist_value > ilist)
 Braced-init-list support for simple arrays.
 

Private Member Functions

 ref (json &js)
 
 ref (json &js, const char *keystr)
 
 ref (const ref &base, const char *keystr)
 
 ref (const ref &base, int index)
 
 ref (const ref &base, const char *, const char *key_suffix)
 
void operator= (const initlist_value &value)
 

Private Attributes

jsonm_js
 
node_path m_path
 

Friends

class json
 

Detailed Description

Reference to a JSON element.

Definition at line 104 of file json.h.

Constructor & Destructor Documentation

◆ ~ref()

json::ref::~ref ( )

Definition at line 115 of file json.cpp.

◆ ref() [1/5]

json::ref::ref ( json js)
explicitprivate

Definition at line 75 of file json.cpp.

◆ ref() [2/5]

json::ref::ref ( json js,
const char *  keystr 
)
private

Definition at line 80 of file json.cpp.

◆ ref() [3/5]

json::ref::ref ( const ref base,
const char *  keystr 
)
private

Definition at line 87 of file json.cpp.

◆ ref() [4/5]

json::ref::ref ( const ref base,
int  index 
)
private

Definition at line 94 of file json.cpp.

◆ ref() [5/5]

json::ref::ref ( const ref base,
const char *  ,
const char *  key_suffix 
)
private

Definition at line 101 of file json.cpp.

Member Function Documentation

◆ operator+=() [1/2]

void json::ref::operator+= ( std::initializer_list< initlist_key_value_pair ilist)

Braced-init-list support for nested objects.

Definition at line 237 of file json.cpp.

◆ operator+=() [2/2]

void json::ref::operator+= ( std::initializer_list< initlist_value ilist)

Braced-init-list support for simple arrays.

Definition at line 249 of file json.cpp.

◆ operator=() [1/10]

void json::ref::operator= ( bool  value)

Definition at line 119 of file json.cpp.

◆ operator=() [2/10]

void json::ref::operator= ( const char *  value)

Definition at line 154 of file json.cpp.

◆ operator=() [3/10]

void json::ref::operator= ( const initlist_value value)
inlineprivate

Definition at line 163 of file json.h.

◆ operator=() [4/10]

void json::ref::operator= ( const std::string &  value)

Definition at line 159 of file json.cpp.

◆ operator=() [5/10]

void json::ref::operator= ( int  value)

Definition at line 134 of file json.cpp.

◆ operator=() [6/10]

void json::ref::operator= ( long long  value)

Definition at line 124 of file json.cpp.

◆ operator=() [7/10]

void json::ref::operator= ( long  value)

Definition at line 144 of file json.cpp.

◆ operator=() [8/10]

void json::ref::operator= ( unsigned long long  value)

Definition at line 129 of file json.cpp.

◆ operator=() [9/10]

void json::ref::operator= ( unsigned long  value)

Definition at line 149 of file json.cpp.

◆ operator=() [10/10]

void json::ref::operator= ( unsigned  value)

Definition at line 139 of file json.cpp.

◆ operator[]() [1/3]

ref json::ref::operator[] ( const char *  keystr) const
inline

Return reference to object element.

Definition at line 110 of file json.h.

◆ operator[]() [2/3]

ref json::ref::operator[] ( const std::string &  keystr) const
inline

Return reference to object element (std::string variant).

Definition at line 114 of file json.h.

◆ operator[]() [3/3]

ref json::ref::operator[] ( int  index) const
inline

Return reference to array element.

Definition at line 118 of file json.h.

◆ set_if_safe_le128()

bool json::ref::set_if_safe_le128 ( const void *  pvalue)

Definition at line 187 of file json.cpp.

◆ set_if_safe_uint128()

bool json::ref::set_if_safe_uint128 ( uint64_t  value_hi,
uint64_t  value_lo 
)

Definition at line 180 of file json.cpp.

◆ set_if_safe_uint64()

bool json::ref::set_if_safe_uint64 ( uint64_t  value)

Definition at line 172 of file json.cpp.

◆ set_uint128()

void json::ref::set_uint128 ( uint64_t  value_hi,
uint64_t  value_lo 
)

Definition at line 164 of file json.cpp.

◆ set_unsafe_le128()

void json::ref::set_unsafe_le128 ( const void *  pvalue)

Definition at line 231 of file json.cpp.

◆ set_unsafe_uint128()

void json::ref::set_unsafe_uint128 ( uint64_t  value_hi,
uint64_t  value_lo 
)

Definition at line 205 of file json.cpp.

◆ set_unsafe_uint64()

void json::ref::set_unsafe_uint64 ( uint64_t  value)

Definition at line 193 of file json.cpp.

◆ with_suffix()

ref json::ref::with_suffix ( const char *  key_suffix) const
inline

Return reference to element with KEY_SUFFIX appended to last key.

Definition at line 135 of file json.h.

Friends And Related Function Documentation

◆ json

friend class json
friend

Definition at line 156 of file json.h.

Member Data Documentation

◆ m_js

json& json::ref::m_js
private

Definition at line 166 of file json.h.

◆ m_path

node_path json::ref::m_path
private

Definition at line 167 of file json.h.


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