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

Represents an entry as a constant value. More...

#include <json.h>

Inheritance diagram for json::jobject::const_value:
json::jobject::entry

Public Member Functions

 const_value (std::string value)
 Constructs a proxy with the provided value. More...
 
const_value get (const std::string &key) const
 Returns another constant value from this object. More...
 
const_value array (const 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
 Reference to the entry data. 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...
 

Detailed Description

Represents an entry as a constant value.

Constructor & Destructor Documentation

◆ const_value()

json::jobject::const_value::const_value ( std::string  value)
inline

Constructs a proxy with the provided value.

Parameters
valueThe entry value to copy

Member Function Documentation

◆ array()

const_value json::jobject::const_value::array ( const 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
Examples
rootarray.cpp.

◆ get()

const_value json::jobject::const_value::get ( const std::string &  key) const
inline

Returns another constant value from this object.

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

Parameters
keyThe key of the subvalue to return
Returns
A proxy for the value for the key
Examples
rootarray.cpp.

◆ ref()

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

Reference to the entry data.

Returns
A reference to the copied entry data

Implements json::jobject::entry.


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