[DEV] add the element add on document
This commit is contained in:
parent
e7723856e4
commit
7ee1c7b524
@ -284,3 +284,24 @@ ejson::Array* ejson::Document::GetSubArray(const etk::UString& _named) const
|
||||
}
|
||||
return tmp->ToArray();
|
||||
}
|
||||
|
||||
|
||||
bool ejson::Document::SetSub(ejson::Value* _value)
|
||||
{
|
||||
if (NULL == _value) {
|
||||
return false;
|
||||
}
|
||||
if (NULL!=m_subElement) {
|
||||
delete(m_subElement);
|
||||
}
|
||||
m_subElement = _value;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ejson::Document::Clear(void)
|
||||
{
|
||||
if (NULL!=m_subElement) {
|
||||
delete(m_subElement);
|
||||
m_subElement=NULL;
|
||||
}
|
||||
}
|
||||
|
@ -70,6 +70,7 @@ namespace ejson
|
||||
ejson::Object* GetSubObject(const etk::UString& _named) const;
|
||||
ejson::String* GetSubString(const etk::UString& _named) const;
|
||||
ejson::Array* GetSubArray(const etk::UString& _named) const;
|
||||
bool SetSub(ejson::Value* _value);
|
||||
private:
|
||||
bool m_writeErrorWhenDetexted;
|
||||
etk::UString m_comment;
|
||||
@ -87,6 +88,7 @@ namespace ejson
|
||||
bool IGenerate(etk::UString& _data, int32_t _indent) const;
|
||||
virtual ejson::Document* ToDocument(void) { return this; };
|
||||
virtual const ejson::Document* ToDocument(void) const { return this; };
|
||||
virtual void Clear(void);
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user