Simpleson
Public Member Functions | Protected Member Functions | List of all members
json::jobject::entry Class Referenceabstract

Representation of a value in the object. More...

#include <json.h>

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

Public Member Functions

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

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

Representation of a value in the object.

Member Function Documentation

◆ as_array()

template<typename T >
std::vector< T > json::jobject::entry::as_array ( ) const
inline

Casts an array.

Template Parameters
TThe type of array to be cast to

◆ as_object()

json::jobject json::jobject::entry::as_object ( ) const
inline

Casts the value as a JSON object.

Note
This method also works for JSON arrays

◆ get_number()

template<typename T >
T json::jobject::entry::get_number ( const char *  format) const
inlineprotected

Converts an serialzed value to a numeric value.

Template Parameters
TheC data type used to represent the value
Parameters
formatThe format used to convert the serialized value to a numeric value
Returns
The value as a number

◆ get_number_array()

template<typename T >
std::vector< T > json::jobject::entry::get_number_array ( const char *  format) const
inlineprotected

Converts a serialized array of numbers to a vector of numbers.

Template Parameters
TheC data type used to represent the values in the array
Parameters
formatThe format used to convert the serialized values in the array to numeric values
Returns
The value as a vector of numbers

◆ operator json::jobject()

json::jobject::entry::operator json::jobject ( ) const
inline

◆ operator std::string()

json::jobject::entry::operator std::string ( ) const
inline

◆ ref()

virtual const std::string & json::jobject::entry::ref ( ) const
protectedpure virtual

A method for reference the entry's value.

Returns
A string represnting the entry's serialized value

Implemented in json::jobject::const_value, and json::jobject::const_proxy.


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