ejson::Document Class Reference

#include <Document.hpp>

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

Public Member Functions

 Document (ememory::SharedPtr< ejson::internal::Value > _internalValue)
 
 Document (const ejson::Document &_obj)
 
 Document ()
 
ejson::Documentoperator= (const ejson::Document &_obj)
 
bool parse (const std::string &_data)
 
bool generate (std::string &_data)
 
bool load (const std::string &_file)
 
bool store (const std::string &_file)
 
bool storeSafe (const std::string &_file)
 
void setDisplayError (bool _value)
 
bool getDisplayError ()
 
void displayError ()
 
- Public Member Functions inherited from ejson::Object
 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

- Public Types inherited from ejson::Object
using iterator = ejson::iterator< ejson::Object >
 
- Protected Attributes inherited from ejson::Value
ememory::SharedPtr< ejson::internal::Valuem_data
 

Detailed Description

ejson Document interface (acces with the file and stream).

Constructor & Destructor Documentation

§ Document() [1/3]

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

Constructor.

Parameters
[in]_internalValueInternal Value to set data

§ Document() [2/3]

ejson::Document::Document ( const ejson::Document _obj)

Copy constructor.

Parameters
[in]_objObject to copy

§ Document() [3/3]

ejson::Document::Document ( )

Constructor.

Member Function Documentation

§ displayError()

void ejson::Document::displayError ( )

Display error detected.

§ generate()

bool ejson::Document::generate ( std::string _data)

generate a string that contain the created Json

Parameters
[out]_dataData where the Json is stored
Returns
false : An error occured
true : Parsing is OK

§ getDisplayError()

bool ejson::Document::getDisplayError ( )

Get the display of the error status.

Returns
true Display error
false Does not display error (get it at end)

§ load()

bool ejson::Document::load ( const std::string _file)

Load the file that might contain the Json.

Parameters
[in]_fileFilename of the Json (compatible with etk FSNode naming)
Returns
false : An error occured
true : Parsing is OK

§ operator=()

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

Copy constructor.

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

§ parse()

bool ejson::Document::parse ( const std::string _data)

parse a string that contain an Json

Parameters
[in]_dataData to parse
Returns
false : An error occured
true : Parsing is OK

§ setDisplayError()

void ejson::Document::setDisplayError ( bool  _value)

Set the display of the error when detected.

Parameters
[in]_valuetrue: display error, false not display error (get it at end)

§ store()

bool ejson::Document::store ( const std::string _file)

Store the Json in the file.

Parameters
[in]_fileFilename of the Json (compatible with etk FSNode naming)
Returns
false : An error occured
true : Parsing is OK

§ storeSafe()

bool ejson::Document::storeSafe ( const std::string _file)

Store the Json in the file (safe mode mean that the file is store in a second file xxx.tmp and moved in the file xxx (only one mode to be really safe with filesystem ...)

Parameters
[in]_fileFilename of the Json (compatible with etk FSNode naming)
Returns
false : An error occured
true : Parsing is OK

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