ejson::Object Class Reference

#include <Object.hpp>

Inheritance diagram for ejson::Object:
ejson::Value ejson::Document

Public Types

using iterator = ejson::iterator< ejson::Object >
 

Public Member Functions

 Object (ememory::SharedPtr< ejson::internal::Value > _internalValue)
 
 Object (const ejson::Object &_obj)
 
 Object ()
 
 Object (const std::string &_data)
 
ejson::Objectoperator= (const ejson::Object &_obj)
 
bool valueExist (const std::string &_name) const
 
ejson::Value operator[] (const std::string &_name)
 
const ejson::Value operator[] (const std::string &_name) const
 
std::vector< std::stringgetKeys () const
 
size_t size () const
 
ejson::Value operator[] (size_t _id)
 
const ejson::Value operator[] (size_t _id) const
 
std::string getKey (size_t _id) const
 
bool add (const std::string &_name, const ejson::Value &_value)
 
void remove (const std::string &_name)
 
void remove (size_t _id)
 
iterator begin ()
 
iterator end ()
 
const iterator begin () const
 
const iterator end () const
 
iterator remove (const iterator &_it)
 
- Public Member Functions inherited from ejson::Value
enum ejson::valueType getType () const
 
 Value (const ememory::SharedPtr< ejson::internal::Value > &_internalValue)
 
 Value ()
 
virtual ~Value ()=default
 
void display () const
 
bool exist () const
 
ejson::Document toDocument ()
 
const ejson::Document toDocument () const
 
ejson::Array toArray ()
 
const ejson::Array toArray () const
 
ejson::Object toObject ()
 
const ejson::Object toObject () const
 
ejson::String toString ()
 
const ejson::String toString () const
 
ejson::Number toNumber ()
 
const ejson::Number toNumber () const
 
ejson::Boolean toBoolean ()
 
const ejson::Boolean toBoolean () const
 
ejson::Null toNull ()
 
const ejson::Null toNull () const
 
bool isDocument () const
 
bool isArray () const
 
bool isObject () const
 
bool isString () const
 
bool isNumber () const
 
bool isBoolean () const
 
bool isNull () const
 
void clear ()
 
bool transfertIn (ejson::Value &_obj)
 
ejson::Value clone () const
 
std::string generateHumanString () const
 
std::string generateMachineString () const
 

Additional Inherited Members

- Protected Attributes inherited from ejson::Value
ememory::SharedPtr< ejson::internal::Valuem_data
 

Detailed Description

ejson Object interface { ... }.

Member Typedef Documentation

§ iterator

Specify iterator of the Object methode.

Constructor & Destructor Documentation

§ Object() [1/4]

ejson::Object::Object ( ememory::SharedPtr< ejson::internal::Value _internalValue)

Constructor.

Parameters
[in]_internalValueInternal Value to set data

§ Object() [2/4]

ejson::Object::Object ( const ejson::Object _obj)

Copy constructor.

Parameters
[in]_objObject to copy

§ Object() [3/4]

ejson::Object::Object ( )

Constructor.

§ Object() [4/4]

ejson::Object::Object ( const std::string _data)

Constructor.

Parameters
[in]_datastring data to parse

Member Function Documentation

§ add()

bool ejson::Object::add ( const std::string _name,
const ejson::Value _value 
)

add an element in the Object

Parameters
[in]_namename of the object
[in]_valueElement to add
Returns
false if an error occured

§ begin() [1/2]

iterator ejson::Object::begin ( )

Get iterator of the first Value.

Returns
iterator on the begin position of the Value

§ begin() [2/2]

const iterator ejson::Object::begin ( ) const

Get const iterator of the first Value.

Returns
const iterator on the begin position of the Value

§ end() [1/2]

iterator ejson::Object::end ( )

Get iterator of the next of the last Value.

Returns
iterator on the next of the last position of the Value

§ end() [2/2]

const iterator ejson::Object::end ( ) const

Get const iterator of the next of the last Value.

Returns
const iterator on the next of the last position of the Value

§ getKey()

std::string ejson::Object::getKey ( size_t  _id) const

Get the element name (key).

Parameters
[in]_idId of the element.
Returns
The name (key).

§ getKeys()

std::vector<std::string> ejson::Object::getKeys ( ) const

Get all the element name (keys).

Returns
a vector of all name (key).

§ operator=()

ejson::Object& ejson::Object::operator= ( const ejson::Object _obj)

Copy constructor.

Parameters
[in]_objObject to copy
Returns
Local reference on this object

§ operator[]() [1/4]

ejson::Value ejson::Object::operator[] ( const std::string _name)

Cet the sub element with his name (no cast check)

Parameters
[in]_nameName of the object
Returns
Value on the element requested or a value that does not exist ejson::Value::exist.

§ operator[]() [2/4]

const ejson::Value ejson::Object::operator[] ( const std::string _name) const

Get the const sub element with his name (no cast check)

Parameters
[in]_nameName of the object
Returns
const Value on the element requested or a value that does not exist ejson::Value::exist.

§ operator[]() [3/4]

ejson::Value ejson::Object::operator[] ( size_t  _id)

Get the value on an element reference with his ID.

Parameters
[in]_idId of the element.
Returns
Value on the element requested or a value that does not exist ejson::Value::exist.

§ operator[]() [4/4]

const ejson::Value ejson::Object::operator[] ( size_t  _id) const

Get the const value on an element reference with his ID.

Parameters
[in]_idId of the element.
Returns
const Value on the element requested or a value that does not exist ejson::Value::exist.

§ remove() [1/3]

void ejson::Object::remove ( const std::string _name)

Remove Value with his name.

Parameters
[in]_nameName of the object

§ remove() [2/3]

void ejson::Object::remove ( size_t  _id)

Remove Value with his id.

Parameters
[in]_idId of the element.

§ remove() [3/3]

iterator ejson::Object::remove ( const iterator _it)

Remove Value with his iterator.

Parameters
[in]_itIterator on the Value.
Returns
New valid iterator on the next element or this.end()

§ size()

size_t ejson::Object::size ( ) const

get the number of sub element in the current one

Returns
the Number of stored element

§ valueExist()

bool ejson::Object::valueExist ( const std::string _name) const

check if an element exist.

Parameters
[in]_nameName of the object.
Returns
The existance of the element.

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