#include <Value.hpp>

Inheritance diagram for ejson::internal::Value:
ememory::EnableSharedFromThis< Value > ememory::EnableSharedFromThisBase ejson::internal::Array ejson::internal::Boolean ejson::internal::Null ejson::internal::Number ejson::internal::Object ejson::internal::String ejson::internal::Document

Public Member Functions

enum ejson::valueType getType () const
 
virtual ~Value ()
 
virtual bool iParse (const std::string &_data, size_t &_pos, ejson::FilePos &_filePos, ejson::internal::Document &_doc)=0
 
virtual bool iGenerate (std::string &_data, size_t _indent) const =0
 
virtual void iMachineGenerate (std::string &_data) const =0
 
void display () const
 
virtual void clear ()
 
virtual bool transfertIn (ememory::SharedPtr< ejson::internal::Value > _obj)
 
virtual ememory::SharedPtr< ejson::internal::Valueclone () const
 
- Public Member Functions inherited from ememory::EnableSharedFromThis< Value >
ememory::SharedPtr< EMEMORY_TYPE > sharedFromThis ()
 
const ememory::SharedPtr< EMEMORY_TYPE > sharedFromThis () const
 
ememory::WeakPtr< EMEMORY_TYPE > weakFromThis ()
 
const ememory::WeakPtr< EMEMORY_TYPE > weakFromThis () const
 

Protected Member Functions

 Value ()
 
void addIndent (std::string &_data, int32_t _indent) const
 
void drawElementParsed (char32_t _val, const ejson::FilePos &_filePos) const
 
bool checkString (char32_t _val) const
 
bool checkNumber (char32_t _val) const
 
int32_t countWhiteChar (const std::string &_data, size_t _pos, ejson::FilePos &_filePos) const
 

Static Protected Member Functions

static bool isWhiteChar (char32_t _val)
 

Protected Attributes

enum ejson::valueType m_type
 

Detailed Description

Basic main object of all json data.

Constructor & Destructor Documentation

§ Value()

ejson::internal::Value::Value ( )
inlineprotected

basic element of a xml structure

§ ~Value()

virtual ejson::internal::Value::~Value ( )
virtual

Virtualize destructor.

Member Function Documentation

§ addIndent()

void ejson::internal::Value::addIndent ( std::string _data,
int32_t  _indent 
) const
protected

add indentation of the string input.

Parameters
[in,out]_dataString where the indentation is done.
[in]_indentNumber of tab to add at the string.

§ checkNumber()

bool ejson::internal::Value::checkNumber ( char32_t  _val) const
protected

check if an number -+.0123456789e).

Parameters
[in]_valValue to check the conformity.
Returns
true The element char is considerable as a number
false The element char is NOT considerable as a number

§ checkString()

bool ejson::internal::Value::checkString ( char32_t  _val) const
protected

check if an name (for object named) (not : !"#$%&'()*+,/;<=>?@[]^`{|}~ \n\t\r).

Parameters
[in]_valValue to check the conformity.
Returns
true The element char is considerable as a string
false The element char is NOT considerable as a string

§ clear()

virtual void ejson::internal::Value::clear ( )
virtual

clear the Node

Reimplemented in ejson::internal::Object, and ejson::internal::Array.

§ clone()

virtual ememory::SharedPtr<ejson::internal::Value> ejson::internal::Value::clone ( ) const
virtual

Copy the curent node and all the child in the curent one.

Returns
nullptr in an error occured, the pointer on the element otherwise

Reimplemented in ejson::internal::Object, ejson::internal::Number, ejson::internal::Array, ejson::internal::Boolean, ejson::internal::String, and ejson::internal::Null.

§ countWhiteChar()

int32_t ejson::internal::Value::countWhiteChar ( const std::string _data,
size_t  _pos,
ejson::FilePos _filePos 
) const
protected

count the number of white char in the string from the specify position (stop at the first element that is not a white char)

Parameters
[in]_dataData to parse.
[in]_posStart position in the string.
[out]_filePosnew poistion of te file to add.
Returns
number of white element.

§ display()

void ejson::internal::Value::display ( ) const

Display the Document on console.

§ drawElementParsed()

void ejson::internal::Value::drawElementParsed ( char32_t  _val,
const ejson::FilePos _filePos 
) const
protected

Display the cuurent element that is curently parse.

Parameters
[in]_valChar that is parsed.
[in]_filePosPosition of the char in the file.

§ getType()

enum ejson::valueType ejson::internal::Value::getType ( ) const

Get Value type.

Returns
Type of the object

§ iGenerate()

virtual bool ejson::internal::Value::iGenerate ( std::string _data,
size_t  _indent 
) const
pure virtual

generate a string with the tree of the json

Parameters
[in,out]_datastring where to add the elements
[in]_indentcurrent indentation of the file
Returns
false if an error occured.

Implemented in ejson::internal::Object, ejson::internal::Document, ejson::internal::Number, ejson::internal::Array, ejson::internal::Boolean, ejson::internal::String, and ejson::internal::Null.

§ iMachineGenerate()

virtual void ejson::internal::Value::iMachineGenerate ( std::string _data) const
pure virtual

generate a string with the tree of the json (not human readable ==> for computer transfer)

Parameters
[in,out]_datastring where to add the elements
Returns
false if an error occured.

Implemented in ejson::internal::Object, ejson::internal::Number, ejson::internal::Array, ejson::internal::Boolean, ejson::internal::String, and ejson::internal::Null.

§ iParse()

virtual bool ejson::internal::Value::iParse ( const std::string _data,
size_t &  _pos,
ejson::FilePos _filePos,
ejson::internal::Document _doc 
)
pure virtual

parse the Current node [pure VIRUAL]

Parameters
[in]_datadata string to parse.
[in,out]_posposition in the string to start parse, return the position end of parsing.
[in,out]_filePosPosition in the file (in X/Y)
[in,out]_docReference on the main document
Returns
false if an error occured.

Implemented in ejson::internal::Object, ejson::internal::Document, ejson::internal::Number, ejson::internal::Array, ejson::internal::Boolean, ejson::internal::String, and ejson::internal::Null.

§ isWhiteChar()

static bool ejson::internal::Value::isWhiteChar ( char32_t  _val)
staticprotected

check if the current element is white or not : '\t' '\n' '\r' ' '

Parameters
[in]_valChar value to check
Returns
tue if it is white char

§ transfertIn()

virtual bool ejson::internal::Value::transfertIn ( ememory::SharedPtr< ejson::internal::Value _obj)
virtual

Tranfert all element in the element set in parameter.

Parameters
[in,out]_objmove all parameter in the selected element
Returns
true if transfer is done corectly
Note
all element is remove from the curent element.

Reimplemented in ejson::internal::Object, ejson::internal::Number, ejson::internal::Array, ejson::internal::Boolean, ejson::internal::String, and ejson::internal::Null.

Member Data Documentation

§ m_type

enum ejson::valueType ejson::internal::Value::m_type
protected

Type of the element.


The documentation for this class was generated from the following file:
  • framework/atria-soft/ejson/ejson/internal/Value.hpp