class: ejson::Object
Description:
Constructor and Destructor:
+ Object ();
+ virtual ~Object ();
Synopsis:
# etk::Hash<ejson::Value*> m_value;
+ bool exist (const std::string & _name) const;
+ ejson::Value* get (const std::string & _name);
+ const ejson::Value* get (const std::string & _name) const;
+ ejson::Value* operator [ ] (const std::string & _name);
+ const ejson::Value* operator [ ] (const std::string & _name) const;
+ std::vector<std::string> getKeys () const;
+ size_t size () const;
+ ejson::Value* get (size_t _id);
+ const ejson::Value* get (size_t _id) const;
+ ejson::Value* operator [ ] (size_t _id);
+ const ejson::Value* operator [ ] (size_t _id) const;
+ std::string getKey (size_t _id) const;
+ ejson::Object* getObject (const std::string & _name);
+ const ejson::Object* getObject (const std::string & _name) const;
+ ejson::Array* getArray (const std::string & _name);
+ const ejson::Array* getArray (const std::string & _name) const;
+ ejson::Null* getNull (const std::string & _name);
+ const ejson::Null* getNull (const std::string & _name) const;
+ ejson::String* getString (const std::string & _name);
+ const ejson::String* getString (const std::string & _name) const;
+ const std::string & getStringValue (const std::string & _name) const;
+ std::string getStringValue (const std::string & _name,
const std::string & _errorValue) const;
+ ejson::Boolean* getBoolean (const std::string & _name);
+ const ejson::Boolean* getBoolean (const std::string & _name) const;
+ bool getBooleanValue (const std::string & _name,
bool _errorValue) const;
+ ejson::Number* getNumber (const std::string & _name);
+ const ejson::Number* getNumber (const std::string & _name) const;
+ double getNumberValue (const std::string & _name,
double _errorValue) const;
+ bool add (const std::string & _name,
ejson::Value* _value);
+ bool addString (const std::string & _name,
const std::string & _value);
+ bool addNull (const std::string & _name);
+ bool addBoolean (const std::string & _name,
bool _value);
+ bool addNumber (const std::string & _name,
double _value);
+ virtual bool iParse (const std::string & _data,
size_t & _pos,
ejson::filePos & _filePos,
ejson::Document & _doc);
+ virtual bool iGenerate (std::string & _data,
size_t _indent) const;
+ virtual void clear ();
+ virtual bool transfertIn (ejson::Value* _obj);
+ virtual ejson::Value* duplicate () const;
Object Hierarchy:
+ejson::Value
+--> ejson::Object
+--> ejson::Document
Detail:
Object
+ Object ();
basic element of a xml structure
~Object
+ virtual ~Object ();
destructor
m_value
# etk::Hash<ejson::Value*> m_value;
value of the node (for element this is the name, for text it is the inside text ...)
exist
+ bool exist (const std::string & _name) const;
check if an element exist.
Parameter [input]: _name name of the object.
Return: The existance of the element.
get
+ ejson::Value* get (const std::string & _name);
+ const ejson::Value* get (const std::string & _name) const;
+ ejson::Value* operator [ ] (const std::string & _name);
+ const ejson::Value* operator [ ] (const std::string & _name) const;
get the sub element with his name (no cast check)
Parameter [input]: _name name of the object
Return: pointer on the element requested or NULL if it not the corect type or does not existed
getKeys
+ std::vector<std::string> getKeys () const;
Get all the element name (keys).
Return: a vector of all name (key).
size
+ size_t size () const;
get the number of sub element in the current one
Return: the Number of stored element
get
+ ejson::Value* get (size_t _id);
+ const ejson::Value* get (size_t _id) const;
+ ejson::Value* operator [ ] (size_t _id);
+ const ejson::Value* operator [ ] (size_t _id) const;
get the pointer on an element reference with his ID.
Parameter [input]: _id Id of the element.
Return: NULL if the element does not exist.
getKey
+ std::string getKey (size_t _id) const;
Get the element name (key).
Parameter [input]: _id Id of the element.
Return: The name (key).
getObject
+ ejson::Object* getObject (const std::string & _name);
+ const ejson::Object* getObject (const std::string & _name) const;
get the sub element with his name (Casted as Object if it is possible)
Parameter [input]: _name name of the object
Return: pointer on the element requested or NULL if it not the corect type or does not existed
getArray
+ ejson::Array* getArray (const std::string & _name);
+ const ejson::Array* getArray (const std::string & _name) const;
get the sub element with his name (Casted as Array if it is possible)
Parameter [input]: _name name of the object
Return: pointer on the element requested or NULL if it not the corect type or does not existed
getNull
+ ejson::Null* getNull (const std::string & _name);
+ const ejson::Null* getNull (const std::string & _name) const;
get the sub element with his name (Casted as Null if it is possible)
Parameter [input]: _name name of the object
Return: pointer on the element requested or NULL if it not the corect type or does not existed
getString
+ ejson::String* getString (const std::string & _name);
+ const ejson::String* getString (const std::string & _name) const;
get the sub element with his name (Casted as String if it is possible)
Parameter [input]: _name name of the object
Return: pointer on the element requested or NULL if it not the corect type or does not existed
getStringValue
+ const std::string & getStringValue (const std::string & _name) const;
get the sub string value of the requested element
Parameter [input]: _name name of the object
Return: Value of the string or an error string (empty)
getStringValue
+ std::string getStringValue (const std::string & _name,
const std::string & _errorValue) const;
get the sub string value of the requested element (with error return value)
Parameter [input]: _name name of the object
Parameter [input]: _errorValue The return value if the element does not exist.
Return: Value of the string or an error string (empty)
getBoolean
+ ejson::Boolean* getBoolean (const std::string & _name);
+ const ejson::Boolean* getBoolean (const std::string & _name) const;
get the sub element with his name (Casted as Boolean if it is possible)
Parameter [input]: _name name of the object
Return: pointer on the element requested or NULL if it not the corect type or does not existed
getBooleanValue
+ bool getBooleanValue (const std::string & _name,
bool _errorValue) const;
get the sub boolean value of the requested element.
Parameter [input]: _name name of the object.
Parameter [input]: _errorValue The return value if the element does not exist.
Return: Value of the Boolean or the _errorValue;
getNumber
+ ejson::Number* getNumber (const std::string & _name);
+ const ejson::Number* getNumber (const std::string & _name) const;
get the sub element with his name (Casted as Number if it is possible)
Parameter [input]: _name name of the object
Return: pointer on the element requested or NULL if it not the corect type or does not existed
getNumberValue
+ double getNumberValue (const std::string & _name,
double _errorValue) const;
get the sub Number value of the requested element.
Parameter [input]: _name name of the object.
Parameter [input]: _errorValue The return value if the element does not exist.
Return: Value of the Number or the _errorValue;
add
+ bool add (const std::string & _name,
ejson::Value* _value);
add an element in the Object
Parameter [input]: _name name of the object
Parameter [input]: _value Element to add
Return: false if an error occured
addString
+ bool addString (const std::string & _name,
const std::string & _value);
add a string element in the Object (automatic creation)
Parameter [input]: _name name of the object
Parameter [input]: _value string value to add
Return: false if an error occured
addNull
+ bool addNull (const std::string & _name);
add a "null" element in the Object (automatic creation)
Parameter [input]: _name name of the object
Return: false if an error occured
addBoolean
+ bool addBoolean (const std::string & _name,
bool _value);
add a boolean element in the Object (automatic creation)
Parameter [input]: _name name of the object
Parameter [input]: _value boolean value to add
Return: false if an error occured
addNumber
+ bool addNumber (const std::string & _name,
double _value);
add a double element in the Object (automatic creation)
Parameter [input]: _name name of the object
Parameter [input]: _value double value to add
Return: false if an error occured
iParse
+ virtual bool iParse (const std::string & _data,
size_t & _pos,
ejson::filePos & _filePos,
ejson::Document & _doc);
parse the Current node [pure VIRUAL]
Parameter [input]: _data data string to parse.
Parameter [input] [output]: _pos position in the string to start parse, return the position end of parsing.
Parameter [input]: _caseSensitive Request a parsion of element that is not case sensitive (all element is in low case)
Parameter [input] [output]: file parsing position (line x col x)
Return: false if an error occured.
iGenerate
+ virtual bool iGenerate (std::string & _data,
size_t _indent) const;
generate a string with the tree of the xml
Parameter [input] [output]: _data string where to add the elements
Parameter [input]: current indentation of the file
Return: false if an error occured.
clear
+ virtual void clear ();
clear the Node
transfertIn
+ virtual bool transfertIn (ejson::Value* _obj);
Tranfert all element in the element set in parameter
Note: all element is remove from the curent element.
Parameter [input] [output]: _obj move all parameter in the selected element
Return: true if transfer is done corectly
duplicate
+ virtual ejson::Value* duplicate () const;
Copy the curent node and all the child in the curent one.
Return: NULL in an error occured, the pointer on the element otherwise
+ejson::Value
+--> ejson::Object
+--> ejson::Document
Detail:
Object
+ Object ();basic element of a xml structure
~Object
+ virtual ~Object ();destructor
m_value
# etk::Hash<ejson::Value*> m_value;value of the node (for element this is the name, for text it is the inside text ...)
exist
+ bool exist (const std::string & _name) const;check if an element exist.
Parameter [input]: | _name | name of the object. |
Return: | The existance of the element. |
get
+ ejson::Value* get (const std::string & _name);get the sub element with his name (no cast check)
+ const ejson::Value* get (const std::string & _name) const;
+ ejson::Value* operator [ ] (const std::string & _name);
+ const ejson::Value* operator [ ] (const std::string & _name) const;
Parameter [input]: | _name | name of the object |
Return: | pointer on the element requested or NULL if it not the corect type or does not existed |
getKeys
+ std::vector<std::string> getKeys () const;Get all the element name (keys).
Return: | a vector of all name (key). |
size
+ size_t size () const;get the number of sub element in the current one
Return: | the Number of stored element |
get
+ ejson::Value* get (size_t _id);get the pointer on an element reference with his ID.
+ const ejson::Value* get (size_t _id) const;
+ ejson::Value* operator [ ] (size_t _id);
+ const ejson::Value* operator [ ] (size_t _id) const;
Parameter [input]: | _id | Id of the element. |
Return: | NULL if the element does not exist. |
getKey
+ std::string getKey (size_t _id) const;Get the element name (key).
Parameter [input]: | _id | Id of the element. |
Return: | The name (key). |
getObject
+ ejson::Object* getObject (const std::string & _name);get the sub element with his name (Casted as Object if it is possible)
+ const ejson::Object* getObject (const std::string & _name) const;
Parameter [input]: | _name | name of the object |
Return: | pointer on the element requested or NULL if it not the corect type or does not existed |
getArray
+ ejson::Array* getArray (const std::string & _name);get the sub element with his name (Casted as Array if it is possible)
+ const ejson::Array* getArray (const std::string & _name) const;
Parameter [input]: | _name | name of the object |
Return: | pointer on the element requested or NULL if it not the corect type or does not existed |
getNull
+ ejson::Null* getNull (const std::string & _name);get the sub element with his name (Casted as Null if it is possible)
+ const ejson::Null* getNull (const std::string & _name) const;
Parameter [input]: | _name | name of the object |
Return: | pointer on the element requested or NULL if it not the corect type or does not existed |
getString
+ ejson::String* getString (const std::string & _name);get the sub element with his name (Casted as String if it is possible)
+ const ejson::String* getString (const std::string & _name) const;
Parameter [input]: | _name | name of the object |
Return: | pointer on the element requested or NULL if it not the corect type or does not existed |
getStringValue
+ const std::string & getStringValue (const std::string & _name) const;get the sub string value of the requested element
Parameter [input]: | _name | name of the object |
Return: | Value of the string or an error string (empty) |
getStringValue
+ std::string getStringValue (const std::string & _name,get the sub string value of the requested element (with error return value)
const std::string & _errorValue) const;
Parameter [input]: | _name | name of the object | Parameter [input]: | _errorValue | The return value if the element does not exist. |
Return: | Value of the string or an error string (empty) |
getBoolean
+ ejson::Boolean* getBoolean (const std::string & _name);get the sub element with his name (Casted as Boolean if it is possible)
+ const ejson::Boolean* getBoolean (const std::string & _name) const;
Parameter [input]: | _name | name of the object |
Return: | pointer on the element requested or NULL if it not the corect type or does not existed |
getBooleanValue
+ bool getBooleanValue (const std::string & _name,get the sub boolean value of the requested element.
bool _errorValue) const;
Parameter [input]: | _name | name of the object. | Parameter [input]: | _errorValue | The return value if the element does not exist. |
Return: | Value of the Boolean or the _errorValue; |
getNumber
+ ejson::Number* getNumber (const std::string & _name);get the sub element with his name (Casted as Number if it is possible)
+ const ejson::Number* getNumber (const std::string & _name) const;
Parameter [input]: | _name | name of the object |
Return: | pointer on the element requested or NULL if it not the corect type or does not existed |
getNumberValue
+ double getNumberValue (const std::string & _name,get the sub Number value of the requested element.
double _errorValue) const;
Parameter [input]: | _name | name of the object. | Parameter [input]: | _errorValue | The return value if the element does not exist. |
Return: | Value of the Number or the _errorValue; |
add
+ bool add (const std::string & _name,add an element in the Object
ejson::Value* _value);
Parameter [input]: | _name | name of the object | Parameter [input]: | _value | Element to add |
Return: | false if an error occured |
addString
+ bool addString (const std::string & _name,add a string element in the Object (automatic creation)
const std::string & _value);
Parameter [input]: | _name | name of the object | Parameter [input]: | _value | string value to add |
Return: | false if an error occured |
addNull
+ bool addNull (const std::string & _name);add a "null" element in the Object (automatic creation)
Parameter [input]: | _name | name of the object |
Return: | false if an error occured |
addBoolean
+ bool addBoolean (const std::string & _name,add a boolean element in the Object (automatic creation)
bool _value);
Parameter [input]: | _name | name of the object | Parameter [input]: | _value | boolean value to add |
Return: | false if an error occured |
addNumber
+ bool addNumber (const std::string & _name,add a double element in the Object (automatic creation)
double _value);
Parameter [input]: | _name | name of the object | Parameter [input]: | _value | double value to add |
Return: | false if an error occured |
iParse
+ virtual bool iParse (const std::string & _data,parse the Current node [pure VIRUAL]
size_t & _pos,
ejson::filePos & _filePos,
ejson::Document & _doc);
Parameter [input]: | _data | data string to parse. | Parameter [input] [output]: | _pos | position in the string to start parse, return the position end of parsing. | Parameter [input]: | _caseSensitive | Request a parsion of element that is not case sensitive (all element is in low case) | Parameter [input] [output]: | file | parsing position (line x col x) |
Return: | false if an error occured. |
iGenerate
+ virtual bool iGenerate (std::string & _data,generate a string with the tree of the xml
size_t _indent) const;
Parameter [input] [output]: | _data | string where to add the elements | Parameter [input]: | current | indentation of the file |
Return: | false if an error occured. |
clear
+ virtual void clear ();clear the Node
transfertIn
+ virtual bool transfertIn (ejson::Value* _obj);Tranfert all element in the element set in parameter
Note: all element is remove from the curent element.
Parameter [input] [output]: | _obj | move all parameter in the selected element |
Return: | true if transfer is done corectly |
duplicate
+ virtual ejson::Value* duplicate () const;Copy the curent node and all the child in the curent one.
Return: | NULL in an error occured, the pointer on the element otherwise |