Simpleson
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
json::jobject::const_proxy Class Reference

Represents an entry as a constant proxy to the value. More...

#include <json.h>

Inheritance diagram for json::jobject::const_proxy:
json::jobject::entry json::jobject::proxy

Public Member Functions

 const_proxy (const jobject &source, const std::string key)
 Constructor. More...
 
const_value array (size_t index) const
 Returns another constant value from this array. More...
 
- Public Member Functions inherited from json::jobject::entry
std::string as_string () const
 Returns a string representation of the value.
 
 operator std::string () const
 
bool operator== (const std::string other) const
 Comparison operator.
 
bool operator!= (const std::string other) const
 Comparison operator.
 
 operator int () const
 Casts the value as an integer.
 
 operator unsigned int () const
 Casts the value as an unsigned integer.
 
 operator long () const
 Casts teh value as a long integer.
 
 operator unsigned long () const
 Casts the value as an unsigned long integer.
 
 operator char () const
 Casts teh value as a char.
 
 operator float () const
 Casts the value as a floating point numer.
 
 operator double () const
 Casts the value as a double-precision floating point number.
 
json::jobject as_object () const
 Casts the value as a JSON object. More...
 
 operator json::jobject () const
 
 operator std::vector< int > () const
 Casts an array of integers.
 
 operator std::vector< unsigned int > () const
 Casts an array of unsigned integers.
 
 operator std::vector< long > () const
 Casts an array of long integers.
 
 operator std::vector< unsigned long > () const
 Casts an array of unsigned long integers.
 
 operator std::vector< char > () const
 Casts an array of chars.
 
 operator std::vector< float > () const
 Casts an array of floating-point numbers.
 
 operator std::vector< double > () const
 Casts an array of double floating-point numbers.
 
 operator std::vector< json::jobject > () const
 Casts an array of JSON objects.
 
 operator std::vector< std::string > () const
 Casts an array of strings.
 
template<typename T >
std::vector< T > as_array () const
 Casts an array. More...
 
bool is_string () const
 Returns true if the value is a string.
 
bool is_number () const
 Returns true if the value is a number.
 
bool is_object () const
 Returns true if the value is an object.
 
bool is_array () const
 Returns true if the value is an array.
 
bool is_bool () const
 Returns true if the value is a bool.
 
bool is_true () const
 Returns true if the value is a boolean and set to true.
 
bool is_null () const
 Returns true if the value is a null value.
 

Protected Member Functions

const std::string & ref () const
 Returns a reference to the value. More...
 
- Protected Member Functions inherited from json::jobject::entry
virtual const std::string & ref () const =0
 A method for reference the entry's value. More...
 
template<typename T >
get_number (const char *format) const
 Converts an serialzed value to a numeric value. More...
 
template<typename T >
std::vector< T > get_number_array (const char *format) const
 Converts a serialized array of numbers to a vector of numbers. More...
 

Protected Attributes

const std::string key
 The key for the referenced value.
 

Detailed Description

Represents an entry as a constant proxy to the value.

This proxy is more memory-efficent than a json::jobject::const_value but cannot use a JSON array as a source

Constructor & Destructor Documentation

◆ const_proxy()

json::jobject::const_proxy::const_proxy ( const jobject source,
const std::string  key 
)
inline

Constructor.

Parameters
sourceThe JSON object the value is being sourced from
keyThe key for the value being referenced

Member Function Documentation

◆ array()

const_value json::jobject::const_proxy::array ( size_t  index) const
inline

Returns another constant value from this array.

This method assumed the entry contains a JSON array and returns another constant value from within

Parameters
indexThe index of the subvalue to return
Returns
A proxy for the value for the index

◆ ref()

const std::string & json::jobject::const_proxy::ref ( ) const
inlineprotectedvirtual

Returns a reference to the value.

Implements json::jobject::entry.


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