Honeycomb  0.1
Component-Model Framework
Public Types | Public Member Functions | List of all members
honey::json::Value_< Config_ > Class Template Reference

Json value variant. Provide a Config to customize the variant's bounded types. More...

#include <Json.h>

Inheritance diagram for honey::json::Value_< Config_ >:
Inheritance graph
[legend]
Collaboration diagram for honey::json::Value_< Config_ >:
Collaboration graph
[legend]

Public Types

typedef Config_ Config
 
typedef Config::Array Array
 Json value array. More...
 
typedef Config::Object Object
 Json object, map of json name/value pairs. May be ObjectUnordered (default) or ObjectOrdered depending on config. More...
 
typedef Config::ObjectUnordered ObjectUnordered
 Object with unordered name/value pairs. More...
 
typedef Config::ObjectOrdered ObjectOrdered
 Object with ordered name/value pairs. More...
 
typedef Config::Variant Variant
 Base class, the underlying variant. More...
 

Public Member Functions

 Value_ ()
 Construct with null value. More...
 
template<class T >
 Value_ (T &&val)
 Attempts to copy/move construct any json value type, otherwise first json value type constructible with val is set as the value. More...
 
 Value_ (const Value_ &rhs)
 
 Value_ (Value_ &rhs)
 
 Value_ (Value_ &&rhs)
 
template<class T >
Value_operator= (T &&val)
 Attempts to copy/move-assign any json value type, otherwise first json value type assignable to val is set as the value. More...
 
Value_operator= (const Value_ &rhs)
 
Value_operator= (Value_ &rhs)
 
Value_operator= (Value_ &&rhs)
 
Value_operator[] (szt i)
 Get value at index in array. More...
 
const Value_operator[] (szt i) const
 
Value_operator[] (const String &name)
 Get value with name in object. Adds null value if it doesn't exist. More...
 
Value_operator[] (const Char *name)
 
Value_operator[] (const char *name)
 
Value_operator[] (const Id &id)
 Get value with id in object. Throws ValueError if it doesn't exist. More...
 
const Value_operator[] (const Id &id) const
 
Value_operator[] (const IdLiteral &id)
 
const Value_operator[] (const IdLiteral &id) const
 
ValueType type () const
 Get active json value type. More...
 
Array::iterator begin ()
 Get iterator to first value in array. More...
 
Array::const_iterator begin () const
 Get iterator to first value in array. More...
 
Array::iterator end ()
 Get iterator to position after the last value in array. More...
 
Array::const_iterator end () const
 Get iterator to position after the last value in array. More...
 
Value_front ()
 Get first value in array. More...
 
const Value_front () const
 
Value_back ()
 Get last value in array. More...
 
const Value_back () const
 
template<class T >
void push_back (T &&val)
 Create Value from val and add value to back of array. More...
 
void pop_back ()
 Remove last value from array. More...
 
bool contains (const Id &id)
 Check if object contains value with id. More...
 
template<class T >
void insert (szt i, T &&val)
 Create Value from val and insert value into array at index. More...
 
template<class T >
pair< typename Object::iterator, bool > insert (const String &name, T &&val)
 Create Value from val and insert name/value pair into object. More...
 
void erase (szt i)
 Erase value at index in array. More...
 
bool erase (const Id &id)
 Erase value with id in object. Returns true if found and erased. More...
 
bool erase (const IdLiteral &id)
 
void clear ()
 Clear all values in array/object. More...
 
bool empty () const
 Check if array/object contains any values. More...
 
szt size () const
 Get number of values in array/object. More...
 

Detailed Description

template<class Config_>
class honey::json::Value_< Config_ >

Json value variant. Provide a Config to customize the variant's bounded types.

Member Typedef Documentation

template<class Config_>
typedef Config::Array honey::json::Value_< Config_ >::Array

Json value array.

template<class Config_>
typedef Config_ honey::json::Value_< Config_ >::Config
template<class Config_>
typedef Config::Object honey::json::Value_< Config_ >::Object

Json object, map of json name/value pairs. May be ObjectUnordered (default) or ObjectOrdered depending on config.

template<class Config_>
typedef Config::ObjectOrdered honey::json::Value_< Config_ >::ObjectOrdered

Object with ordered name/value pairs.

See also
ObjectOrdered::orderedNames.
template<class Config_>
typedef Config::ObjectUnordered honey::json::Value_< Config_ >::ObjectUnordered

Object with unordered name/value pairs.

template<class Config_>
typedef Config::Variant honey::json::Value_< Config_ >::Variant

Base class, the underlying variant.

Constructor & Destructor Documentation

template<class Config_>
honey::json::Value_< Config_ >::Value_ ( )
inline

Construct with null value.

template<class Config_>
template<class T >
honey::json::Value_< Config_ >::Value_ ( T &&  val)
inline

Attempts to copy/move construct any json value type, otherwise first json value type constructible with val is set as the value.

template<class Config_>
honey::json::Value_< Config_ >::Value_ ( const Value_< Config_ > &  rhs)
inline
template<class Config_>
honey::json::Value_< Config_ >::Value_ ( Value_< Config_ > &  rhs)
inline
template<class Config_>
honey::json::Value_< Config_ >::Value_ ( Value_< Config_ > &&  rhs)
inline

Member Function Documentation

template<class Config_>
Value_& honey::json::Value_< Config_ >::back ( )
inline

Get last value in array.

template<class Config_>
const Value_& honey::json::Value_< Config_ >::back ( ) const
inline
template<class Config_>
Array::iterator honey::json::Value_< Config_ >::begin ( )
inline

Get iterator to first value in array.

template<class Config_>
Array::const_iterator honey::json::Value_< Config_ >::begin ( ) const
inline

Get iterator to first value in array.

template<class Config_>
void honey::json::Value_< Config_ >::clear ( )
inline

Clear all values in array/object.

template<class Config_>
bool honey::json::Value_< Config_ >::contains ( const Id id)
inline

Check if object contains value with id.

template<class Config_>
bool honey::json::Value_< Config_ >::empty ( ) const
inline

Check if array/object contains any values.

template<class Config_>
Array::iterator honey::json::Value_< Config_ >::end ( )
inline

Get iterator to position after the last value in array.

template<class Config_>
Array::const_iterator honey::json::Value_< Config_ >::end ( ) const
inline

Get iterator to position after the last value in array.

template<class Config_>
void honey::json::Value_< Config_ >::erase ( szt  i)
inline

Erase value at index in array.

template<class Config_>
bool honey::json::Value_< Config_ >::erase ( const Id id)
inline

Erase value with id in object. Returns true if found and erased.

template<class Config_>
bool honey::json::Value_< Config_ >::erase ( const IdLiteral id)
inline
template<class Config_>
Value_& honey::json::Value_< Config_ >::front ( )
inline

Get first value in array.

template<class Config_>
const Value_& honey::json::Value_< Config_ >::front ( ) const
inline
template<class Config_>
template<class T >
void honey::json::Value_< Config_ >::insert ( szt  i,
T &&  val 
)
inline

Create Value from val and insert value into array at index.

template<class Config_>
template<class T >
pair<typename Object::iterator, bool> honey::json::Value_< Config_ >::insert ( const String name,
T &&  val 
)
inline

Create Value from val and insert name/value pair into object.

Return values
pair-iteriterator to new name/value pair in object on success, otherwise iterator to existing pair in object
successtrue if name is unique and value was inserted
template<class Config_>
template<class T >
Value_& honey::json::Value_< Config_ >::operator= ( T &&  val)
inline

Attempts to copy/move-assign any json value type, otherwise first json value type assignable to val is set as the value.

template<class Config_>
Value_& honey::json::Value_< Config_ >::operator= ( const Value_< Config_ > &  rhs)
inline
template<class Config_>
Value_& honey::json::Value_< Config_ >::operator= ( Value_< Config_ > &  rhs)
inline
template<class Config_>
Value_& honey::json::Value_< Config_ >::operator= ( Value_< Config_ > &&  rhs)
inline
template<class Config_>
Value_& honey::json::Value_< Config_ >::operator[] ( szt  i)
inline

Get value at index in array.

template<class Config_>
const Value_& honey::json::Value_< Config_ >::operator[] ( szt  i) const
inline
template<class Config_>
Value_& honey::json::Value_< Config_ >::operator[] ( const String name)
inline

Get value with name in object. Adds null value if it doesn't exist.

template<class Config_>
Value_& honey::json::Value_< Config_ >::operator[] ( const Char name)
inline
template<class Config_>
Value_& honey::json::Value_< Config_ >::operator[] ( const char *  name)
inline
template<class Config_>
Value_& honey::json::Value_< Config_ >::operator[] ( const Id id)
inline

Get value with id in object. Throws ValueError if it doesn't exist.

template<class Config_>
const Value_& honey::json::Value_< Config_ >::operator[] ( const Id id) const
inline
template<class Config_>
Value_& honey::json::Value_< Config_ >::operator[] ( const IdLiteral id)
inline
template<class Config_>
const Value_& honey::json::Value_< Config_ >::operator[] ( const IdLiteral id) const
inline
template<class Config_>
void honey::json::Value_< Config_ >::pop_back ( )
inline

Remove last value from array.

template<class Config_>
template<class T >
void honey::json::Value_< Config_ >::push_back ( T &&  val)
inline

Create Value from val and add value to back of array.

template<class Config_>
szt honey::json::Value_< Config_ >::size ( ) const
inline

Get number of values in array/object.

template<class Config_>
ValueType honey::json::Value_< Config_ >::type ( ) const
inline

Get active json value type.


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