[DEV] add capabilities at the ejson parser
This commit is contained in:
parent
2627da57d8
commit
3c102ab263
@ -47,7 +47,8 @@ namespace ejson
|
|||||||
private:
|
private:
|
||||||
etk::Vector<ejson::Value*> m_value; //!< vector of sub elements
|
etk::Vector<ejson::Value*> m_value; //!< vector of sub elements
|
||||||
public:
|
public:
|
||||||
|
esize_t Size(void) { return m_value.Size(); };
|
||||||
|
ejson::Value* Get(esize_t _id) { return m_value[_id]; };
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Get the node type.
|
* @brief Get the node type.
|
||||||
|
@ -212,3 +212,16 @@ ejson::Array* ejson::Object::GetSubArray(const etk::UString& _named) const
|
|||||||
}
|
}
|
||||||
return tmp->ToArray();
|
return tmp->ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ejson::Object::AddSub(const etk::UString& _name, ejson::Value* _value)
|
||||||
|
{
|
||||||
|
if (NULL == _value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_name.Size()==0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_value.Add(_name, _value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -52,6 +52,8 @@ namespace ejson
|
|||||||
ejson::Object* GetSubObject(const etk::UString& _named) const;
|
ejson::Object* GetSubObject(const etk::UString& _named) const;
|
||||||
ejson::String* GetSubString(const etk::UString& _named) const;
|
ejson::String* GetSubString(const etk::UString& _named) const;
|
||||||
ejson::Array* GetSubArray(const etk::UString& _named) const;
|
ejson::Array* GetSubArray(const etk::UString& _named) const;
|
||||||
|
public:
|
||||||
|
void AddSub(const etk::UString& _name, ejson::Value* _value);
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Get the node type.
|
* @brief Get the node type.
|
||||||
|
@ -25,6 +25,7 @@ namespace ejson
|
|||||||
* @brief basic element of a xml structure
|
* @brief basic element of a xml structure
|
||||||
*/
|
*/
|
||||||
String(bool _quoted=false) : m_quoted(_quoted) { };
|
String(bool _quoted=false) : m_quoted(_quoted) { };
|
||||||
|
String(const etk::UString& _value) : m_quoted(false), m_value(_value) { };
|
||||||
/**
|
/**
|
||||||
* @brief destructor
|
* @brief destructor
|
||||||
*/
|
*/
|
||||||
@ -53,7 +54,7 @@ namespace ejson
|
|||||||
* @brief Set the value of the node.
|
* @brief Set the value of the node.
|
||||||
* @param[in] _value New value of the node.
|
* @param[in] _value New value of the node.
|
||||||
*/
|
*/
|
||||||
void SetValue(etk::UString _value) { m_value = _value; };
|
void SetValue(const etk::UString& _value) { m_value = _value; };
|
||||||
/**
|
/**
|
||||||
* @brief Get the current element Value.
|
* @brief Get the current element Value.
|
||||||
* @return the reference of the string value.
|
* @return the reference of the string value.
|
||||||
|
@ -159,6 +159,12 @@ namespace ejson
|
|||||||
*/
|
*/
|
||||||
int32_t CountWhiteChar(const etk::UString& _data, int32_t _pos, ejson::filePos& _filePos) const;
|
int32_t CountWhiteChar(const etk::UString& _data, int32_t _pos, ejson::filePos& _filePos) const;
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Cast the element in a Value if it is possible.
|
||||||
|
* @return pointer on the class or NULL.
|
||||||
|
*/
|
||||||
|
virtual ejson::Value* ToValue(void) { return this; };
|
||||||
|
virtual const ejson::Value* ToValue(void) const { return this; };
|
||||||
/**
|
/**
|
||||||
* @brief Cast the element in a Document if it is possible.
|
* @brief Cast the element in a Document if it is possible.
|
||||||
* @return pointer on the class or NULL.
|
* @return pointer on the class or NULL.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user