[DEV] add more capabilities at all objects
This commit is contained in:
parent
17ca49b86f
commit
cc4cdca147
@ -155,7 +155,7 @@ bool ejson::Array::IGenerate(etk::UString& _data, int32_t _indent) const
|
||||
if (true==tmp->IsString()) {
|
||||
ejson::String* tmp2 = tmp->ToString();
|
||||
if (NULL!=tmp2) {
|
||||
if(tmp2->GetValue().Size()>40) {
|
||||
if(tmp2->Get().Size()>40) {
|
||||
oneLine=false;
|
||||
break;
|
||||
}
|
||||
@ -201,6 +201,26 @@ bool ejson::Array::Add(ejson::Value* _element)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ejson::Array::AddString(const etk::UString& _value)
|
||||
{
|
||||
return Add(new ejson::String(_value));
|
||||
}
|
||||
|
||||
bool ejson::Array::AddNull(void)
|
||||
{
|
||||
return Add(new ejson::Null());
|
||||
}
|
||||
|
||||
bool ejson::Array::AddBoolean(bool _value)
|
||||
{
|
||||
return Add(new ejson::Boolean(_value));
|
||||
}
|
||||
|
||||
bool ejson::Array::AddNumber(double _value)
|
||||
{
|
||||
return Add(new ejson::Number(_value));
|
||||
}
|
||||
|
||||
|
||||
bool ejson::Array::TransfertIn(ejson::Value* _obj)
|
||||
{
|
||||
@ -267,4 +287,30 @@ ejson::Array* ejson::Array::GetArray(esize_t _id)
|
||||
return tmpElement->ToArray();
|
||||
}
|
||||
|
||||
ejson::Null* ejson::Array::GetNull(esize_t _id)
|
||||
{
|
||||
ejson::Value* tmpElement = m_value[_id];
|
||||
if (NULL == tmpElement) {
|
||||
return NULL;
|
||||
}
|
||||
return tmpElement->ToNull();
|
||||
}
|
||||
|
||||
ejson::Number* ejson::Array::GetNumber(esize_t _id)
|
||||
{
|
||||
ejson::Value* tmpElement = m_value[_id];
|
||||
if (NULL == tmpElement) {
|
||||
return NULL;
|
||||
}
|
||||
return tmpElement->ToNumber();
|
||||
}
|
||||
|
||||
ejson::Boolean* ejson::Array::GetBoolean(esize_t _id)
|
||||
{
|
||||
ejson::Value* tmpElement = m_value[_id];
|
||||
if (NULL == tmpElement) {
|
||||
return NULL;
|
||||
}
|
||||
return tmpElement->ToBoolean();
|
||||
}
|
||||
|
||||
|
@ -53,18 +53,73 @@ namespace ejson
|
||||
* @return NULL if the element does not exist.
|
||||
*/
|
||||
ejson::String* GetString(esize_t _id);
|
||||
/**
|
||||
* @brief Get the value of the string element (if not a strin return "")
|
||||
* @param[in] _id Id of the element.
|
||||
* @return value of the element
|
||||
*/
|
||||
const etk::UString& GetStringValue(esize_t _id);
|
||||
/**
|
||||
* @brief Get the value of the string element (if not a strin return "")
|
||||
* @param[in] _id Id of the element.
|
||||
* @return value of the element
|
||||
*/
|
||||
etk::UString GetStringValue(esize_t _id, const etk::UString& _errorValue);
|
||||
/**
|
||||
* @brief Get the pointer on an element reference with his ID (casted in Array if it is an Array).
|
||||
* @param[in] _id Id of the element.
|
||||
* @return NULL if the element does not exist.
|
||||
*/
|
||||
ejson::Array* GetArray(esize_t _id);
|
||||
/**
|
||||
* @brief Get the pointer on an element reference with his ID (casted in Null if it is an Null).
|
||||
* @param[in] _id Id of the element.
|
||||
* @return NULL if the element does not exist.
|
||||
*/
|
||||
ejson::Null* GetNull(esize_t _id);
|
||||
/**
|
||||
* @brief Get the pointer on an element reference with his ID (casted in Number if it is an Number).
|
||||
* @param[in] _id Id of the element.
|
||||
* @return NULL if the element does not exist.
|
||||
*/
|
||||
ejson::Number* GetNumber(esize_t _id);
|
||||
/**
|
||||
* @brief Get the pointer on an element reference with his ID (casted in Boolean if it is an Boolean).
|
||||
* @param[in] _id Id of the element.
|
||||
* @return NULL if the element does not exist.
|
||||
*/
|
||||
ejson::Boolean* GetBoolean(esize_t _id);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Add an element on the array.
|
||||
* @param[in] _element element to add.
|
||||
* @return false if an error occured.
|
||||
*/
|
||||
bool Add(ejson::Value* _element);
|
||||
/**
|
||||
* @brief Add a string element in the Object (automatic creation)
|
||||
* @param[in] _value string value to add
|
||||
* @return false if an error occured
|
||||
*/
|
||||
bool AddString(const etk::UString& _value);
|
||||
/**
|
||||
* @brief Add a "null" element in the Object (automatic creation)
|
||||
* @return false if an error occured
|
||||
*/
|
||||
bool AddNull(void);
|
||||
/**
|
||||
* @brief Add a boolean element in the Object (automatic creation)
|
||||
* @param[in] _value boolean value to add
|
||||
* @return false if an error occured
|
||||
*/
|
||||
bool AddBoolean(bool _value);
|
||||
/**
|
||||
* @brief Add a double element in the Object (automatic creation)
|
||||
* @param[in] _value double value to add
|
||||
* @return false if an error occured
|
||||
*/
|
||||
bool AddNumber(double _value);
|
||||
|
||||
public: // herited function :
|
||||
virtual bool IParse(const etk::UString& _data, int32_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc);
|
||||
|
@ -34,12 +34,12 @@ namespace ejson
|
||||
* @brief Set the value of the node.
|
||||
* @param[in] _value New value of the node.
|
||||
*/
|
||||
void SetValue(bool _value) { m_value = _value; };
|
||||
void Set(bool _value) { m_value = _value; };
|
||||
/**
|
||||
* @brief Get the current element Value.
|
||||
* @return the reference of the string value.
|
||||
*/
|
||||
bool GetValue(void) const { return m_value; };
|
||||
bool Get(void) const { return m_value; };
|
||||
public: // herited function :
|
||||
virtual bool IParse(const etk::UString& _data, int32_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc);
|
||||
virtual bool IGenerate(etk::UString& _data, int32_t _indent) const;
|
||||
|
@ -34,12 +34,14 @@ namespace ejson
|
||||
* @brief Set the value of the node.
|
||||
* @param[in] _value New value of the node.
|
||||
*/
|
||||
void SetValue(double _value) { m_value = _value; };
|
||||
void Set(double _value) { m_value = _value; };
|
||||
/**
|
||||
* @brief Get the current element Value.
|
||||
* @return the reference of the string value.
|
||||
*/
|
||||
double GetValue(void) const { return m_value; };
|
||||
double Get(void) const { return m_value; };
|
||||
int32_t GetInt32(void) const { return (int32_t)m_value; };
|
||||
int64_t GetInt64(void) const { return (int64_t)m_value; };
|
||||
public: // herited function :
|
||||
virtual bool IParse(const etk::UString& _data, int32_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc);
|
||||
virtual bool IGenerate(etk::UString& _data, int32_t _indent) const;
|
||||
|
142
ejson/Object.cpp
142
ejson/Object.cpp
@ -121,7 +121,7 @@ bool ejson::Object::IParse(const etk::UString& _data, int32_t& _pos, ejson::file
|
||||
return false;
|
||||
}
|
||||
tmpElement->IParse(_data, iii, _filePos, _doc);
|
||||
AddSub(currentName, tmpElement);
|
||||
Add(currentName, tmpElement);
|
||||
currentName = "";
|
||||
} else if (_data[iii]=='"') {
|
||||
// find a string:
|
||||
@ -133,7 +133,7 @@ bool ejson::Object::IParse(const etk::UString& _data, int32_t& _pos, ejson::file
|
||||
return false;
|
||||
}
|
||||
tmpElement->IParse(_data, iii, _filePos, _doc);
|
||||
AddSub(currentName, tmpElement);
|
||||
Add(currentName, tmpElement);
|
||||
currentName = "";
|
||||
} else if (_data[iii]=='[') {
|
||||
// find a list:
|
||||
@ -145,7 +145,7 @@ bool ejson::Object::IParse(const etk::UString& _data, int32_t& _pos, ejson::file
|
||||
return false;
|
||||
}
|
||||
tmpElement->IParse(_data, iii, _filePos, _doc);
|
||||
AddSub(currentName, tmpElement);
|
||||
Add(currentName, tmpElement);
|
||||
currentName = "";
|
||||
} else if( _data[iii] == 'f'
|
||||
|| _data[iii] == 't' ) {
|
||||
@ -158,7 +158,7 @@ bool ejson::Object::IParse(const etk::UString& _data, int32_t& _pos, ejson::file
|
||||
return false;
|
||||
}
|
||||
tmpElement->IParse(_data, iii, _filePos, _doc);
|
||||
AddSub(currentName, tmpElement);
|
||||
Add(currentName, tmpElement);
|
||||
currentName = "";
|
||||
} else if( _data[iii] == 'n') {
|
||||
// find null:
|
||||
@ -170,7 +170,7 @@ bool ejson::Object::IParse(const etk::UString& _data, int32_t& _pos, ejson::file
|
||||
return false;
|
||||
}
|
||||
tmpElement->IParse(_data, iii, _filePos, _doc);
|
||||
AddSub(currentName, tmpElement);
|
||||
Add(currentName, tmpElement);
|
||||
currentName = "";
|
||||
} else if(true==CheckNumber(_data[iii])) {
|
||||
// find number:
|
||||
@ -182,7 +182,7 @@ bool ejson::Object::IParse(const etk::UString& _data, int32_t& _pos, ejson::file
|
||||
return false;
|
||||
}
|
||||
tmpElement->IParse(_data, iii, _filePos, _doc);
|
||||
AddSub(currentName, tmpElement);
|
||||
Add(currentName, tmpElement);
|
||||
currentName = "";
|
||||
} else if(_data[iii]==',') {
|
||||
// find Separator : Restart cycle ...
|
||||
@ -228,7 +228,7 @@ bool ejson::Object::IGenerate(etk::UString& _data, int32_t _indent) const
|
||||
if (true==tmp->IsString()) {
|
||||
ejson::String* tmp2 = tmp->ToString();
|
||||
if (NULL!=tmp2) {
|
||||
if( tmp2->GetValue().Size()>25
|
||||
if( tmp2->Get().Size()>25
|
||||
|| m_value.GetKey(iii).Size()>25) {
|
||||
oneLine=false;
|
||||
break;
|
||||
@ -266,44 +266,112 @@ bool ejson::Object::IGenerate(etk::UString& _data, int32_t _indent) const
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
ejson::Value* ejson::Object::GetSub(const etk::UString& _named) const
|
||||
bool ejson::Object::Exist(const etk::UString& _name) const
|
||||
{
|
||||
if (false==m_value.Exist(_named)) {
|
||||
return NULL;
|
||||
}
|
||||
return m_value[_named];
|
||||
return m_value.Exist(_name);
|
||||
}
|
||||
|
||||
ejson::Object* ejson::Object::GetSubObject(const etk::UString& _named) const
|
||||
ejson::Value* ejson::Object::Get(const etk::UString& _name) const
|
||||
{
|
||||
ejson::Value* tmp = GetSub(_named);
|
||||
if (false==m_value.Exist(_name)) {
|
||||
return NULL;
|
||||
}
|
||||
return m_value[_name];
|
||||
}
|
||||
|
||||
ejson::Object* ejson::Object::GetObject(const etk::UString& _name) const
|
||||
{
|
||||
ejson::Value* tmp = Get(_name);
|
||||
if (NULL == tmp) {
|
||||
return NULL;
|
||||
}
|
||||
return tmp->ToObject();
|
||||
}
|
||||
|
||||
ejson::String* ejson::Object::GetSubString(const etk::UString& _named) const
|
||||
ejson::Array* ejson::Object::GetArray(const etk::UString& _name) const
|
||||
{
|
||||
ejson::Value* tmp = GetSub(_named);
|
||||
if (NULL == tmp) {
|
||||
return NULL;
|
||||
}
|
||||
return tmp->ToString();
|
||||
}
|
||||
|
||||
ejson::Array* ejson::Object::GetSubArray(const etk::UString& _named) const
|
||||
{
|
||||
ejson::Value* tmp = GetSub(_named);
|
||||
ejson::Value* tmp = Get(_name);
|
||||
if (NULL == tmp) {
|
||||
return NULL;
|
||||
}
|
||||
return tmp->ToArray();
|
||||
}
|
||||
|
||||
ejson::Null* ejson::Object::GetNull(const etk::UString& _name) const
|
||||
{
|
||||
ejson::Value* tmp = Get(_name);
|
||||
if (NULL == tmp) {
|
||||
return NULL;
|
||||
}
|
||||
return tmp->ToNull();
|
||||
}
|
||||
|
||||
bool ejson::Object::AddSub(const etk::UString& _name, ejson::Value* _value)
|
||||
ejson::String* ejson::Object::GetString(const etk::UString& _name) const
|
||||
{
|
||||
ejson::Value* tmp = Get(_name);
|
||||
if (NULL == tmp) {
|
||||
return NULL;
|
||||
}
|
||||
return tmp->ToString();
|
||||
}
|
||||
|
||||
const etk::UString& ejson::Object::GetStringValue(const etk::UString& _name) const
|
||||
{
|
||||
static const etk::UString errorString("");
|
||||
ejson::String* tmpp = GetString(_name);
|
||||
if (NULL==tmpp) {
|
||||
return errorString;
|
||||
}
|
||||
return tmpp->Get();
|
||||
}
|
||||
|
||||
etk::UString ejson::Object::GetStringValue(const etk::UString& _name, const etk::UString& _errorValue) const
|
||||
{
|
||||
ejson::String* tmpp = GetString(_name);
|
||||
if (NULL==tmpp) {
|
||||
return _errorValue;
|
||||
}
|
||||
return tmpp->Get();
|
||||
}
|
||||
|
||||
ejson::Boolean* ejson::Object::GetBoolean(const etk::UString& _name) const
|
||||
{
|
||||
ejson::Value* tmp = Get(_name);
|
||||
if (NULL == tmp) {
|
||||
return NULL;
|
||||
}
|
||||
return tmp->ToBoolean();
|
||||
}
|
||||
|
||||
bool ejson::Object::GetBooleanValue(const etk::UString& _name, bool _errorValue) const
|
||||
{
|
||||
ejson::Boolean* tmpp = GetBoolean(_name);
|
||||
if (NULL==tmpp) {
|
||||
return _errorValue;
|
||||
}
|
||||
return tmpp->Get();
|
||||
}
|
||||
|
||||
ejson::Number* ejson::Object::GetNumber(const etk::UString& _name) const
|
||||
{
|
||||
ejson::Value* tmp = Get(_name);
|
||||
if (NULL == tmp) {
|
||||
return NULL;
|
||||
}
|
||||
return tmp->ToNumber();
|
||||
}
|
||||
|
||||
double ejson::Object::GetNumberValue(const etk::UString& _name, double _errorValue) const
|
||||
{
|
||||
ejson::Number* tmpp = GetNumber(_name);
|
||||
if (NULL==tmpp) {
|
||||
return _errorValue;
|
||||
}
|
||||
return tmpp->Get();
|
||||
}
|
||||
|
||||
|
||||
bool ejson::Object::Add(const etk::UString& _name, ejson::Value* _value)
|
||||
{
|
||||
if (NULL == _value) {
|
||||
return false;
|
||||
@ -321,7 +389,25 @@ bool ejson::Object::AddSub(const etk::UString& _name, ejson::Value* _value)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ejson::Object::AddString(const etk::UString& _name, const etk::UString& _value)
|
||||
{
|
||||
return Add(_name, new ejson::String(_value));
|
||||
}
|
||||
|
||||
bool ejson::Object::AddNull(const etk::UString& _name)
|
||||
{
|
||||
return Add(_name, new ejson::Null());
|
||||
}
|
||||
|
||||
bool ejson::Object::AddBoolean(const etk::UString& _name, bool _value)
|
||||
{
|
||||
return Add(_name, new ejson::Boolean(_value));
|
||||
}
|
||||
|
||||
bool ejson::Object::AddNumber(const etk::UString& _name, double _value)
|
||||
{
|
||||
return Add(_name, new ejson::Number(_value));
|
||||
}
|
||||
|
||||
bool ejson::Object::TransfertIn(ejson::Value* _obj)
|
||||
{
|
||||
@ -357,7 +443,7 @@ ejson::Value* ejson::Object::Duplicate(void) const
|
||||
if (NULL == val) {
|
||||
continue;
|
||||
}
|
||||
output->AddSub(key, val->Duplicate());
|
||||
output->Add(key, val->Duplicate());
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
100
ejson/Object.h
100
ejson/Object.h
@ -32,29 +32,80 @@ namespace ejson
|
||||
etk::Hash<ejson::Value*> m_value; //!< value of the node (for element this is the name, for text it is the inside text ...)
|
||||
public:
|
||||
/**
|
||||
* @brief Get tht sub element with his name (no cast check)
|
||||
* @param[in] _name name of the object
|
||||
* @return pointer on the element requested or NULL if it not the corect type or does not existed
|
||||
* @brief Check if an element exist.
|
||||
* @param[in] _name name of the object.
|
||||
* @return The existance of the element.
|
||||
*/
|
||||
ejson::Value* GetSub(const etk::UString& _name) const;
|
||||
bool Exist(const etk::UString& _name) const;
|
||||
/**
|
||||
* @brief Get tht sub element with his name (Casted as Object if it is possible)
|
||||
* @brief Get the sub element with his name (no cast check)
|
||||
* @param[in] _name name of the object
|
||||
* @return pointer on the element requested or NULL if it not the corect type or does not existed
|
||||
*/
|
||||
ejson::Object* GetSubObject(const etk::UString& _name) const;
|
||||
ejson::Value* Get(const etk::UString& _name) const;
|
||||
/**
|
||||
* @brief Get tht sub element with his name (Casted as String if it is possible)
|
||||
* @brief Get the sub element with his name (Casted as Object if it is possible)
|
||||
* @param[in] _name name of the object
|
||||
* @return pointer on the element requested or NULL if it not the corect type or does not existed
|
||||
*/
|
||||
ejson::String* GetSubString(const etk::UString& _name) const;
|
||||
ejson::Object* GetObject(const etk::UString& _name) const;
|
||||
/**
|
||||
* @brief Get tht sub element with his name (Casted as Array if it is possible)
|
||||
* @brief Get the sub element with his name (Casted as Array if it is possible)
|
||||
* @param[in] _name name of the object
|
||||
* @return pointer on the element requested or NULL if it not the corect type or does not existed
|
||||
*/
|
||||
ejson::Array* GetSubArray(const etk::UString& _name) const;
|
||||
ejson::Array* GetArray(const etk::UString& _name) const;
|
||||
/**
|
||||
* @brief Get the sub element with his name (Casted as Null if it is possible)
|
||||
* @param[in] _name name of the object
|
||||
* @return pointer on the element requested or NULL if it not the corect type or does not existed
|
||||
*/
|
||||
ejson::Null* GetNull(const etk::UString& _name) const;
|
||||
/**
|
||||
* @brief Get the sub element with his name (Casted as String if it is possible)
|
||||
* @param[in] _name name of the object
|
||||
* @return pointer on the element requested or NULL if it not the corect type or does not existed
|
||||
*/
|
||||
ejson::String* GetString(const etk::UString& _name) const;
|
||||
/**
|
||||
* @brief Get the sub string value of the requested element
|
||||
* @param[in] _name name of the object
|
||||
* @return Value of the string or an error string (empty)
|
||||
*/
|
||||
const etk::UString& GetStringValue(const etk::UString& _name) const;
|
||||
/**
|
||||
* @brief Get the sub string value of the requested element (with error return value)
|
||||
* @param[in] _name name of the object
|
||||
* @param[in] _errorValue The return value if the element does not exist.
|
||||
* @return Value of the string or an error string (empty)
|
||||
*/
|
||||
etk::UString GetStringValue(const etk::UString& _name, const etk::UString& _errorValue) const;
|
||||
/**
|
||||
* @brief Get the sub element with his name (Casted as Boolean if it is possible)
|
||||
* @param[in] _name name of the object
|
||||
* @return pointer on the element requested or NULL if it not the corect type or does not existed
|
||||
*/
|
||||
ejson::Boolean* GetBoolean(const etk::UString& _name) const;
|
||||
/**
|
||||
* @brief Get the sub boolean value of the requested element.
|
||||
* @param[in] _name name of the object.
|
||||
* @param[in] _errorValue The return value if the element does not exist.
|
||||
* @return Value of the Boolean or the _errorValue;
|
||||
*/
|
||||
bool GetBooleanValue(const etk::UString& _name, bool _errorValue=false) const;
|
||||
/**
|
||||
* @brief Get the sub element with his name (Casted as Number if it is possible)
|
||||
* @param[in] _name name of the object
|
||||
* @return pointer on the element requested or NULL if it not the corect type or does not existed
|
||||
*/
|
||||
ejson::Number* GetNumber(const etk::UString& _name) const;
|
||||
/**
|
||||
* @brief Get the sub Number value of the requested element.
|
||||
* @param[in] _name name of the object.
|
||||
* @param[in] _errorValue The return value if the element does not exist.
|
||||
* @return Value of the Number or the _errorValue;
|
||||
*/
|
||||
double GetNumberValue(const etk::UString& _name, double _errorValue=false) const;
|
||||
public:
|
||||
/**
|
||||
* @brief Add an element in the Object
|
||||
@ -62,7 +113,34 @@ namespace ejson
|
||||
* @param[in] _value Element to add
|
||||
* @return false if an error occured
|
||||
*/
|
||||
bool AddSub(const etk::UString& _name, ejson::Value* _value);
|
||||
bool Add(const etk::UString& _name, ejson::Value* _value);
|
||||
/**
|
||||
* @brief Add a string element in the Object (automatic creation)
|
||||
* @param[in] _name name of the object
|
||||
* @param[in] _value string value to add
|
||||
* @return false if an error occured
|
||||
*/
|
||||
bool AddString(const etk::UString& _name, const etk::UString& _value);
|
||||
/**
|
||||
* @brief Add a "null" element in the Object (automatic creation)
|
||||
* @param[in] _name name of the object
|
||||
* @return false if an error occured
|
||||
*/
|
||||
bool AddNull(const etk::UString& _name);
|
||||
/**
|
||||
* @brief Add a boolean element in the Object (automatic creation)
|
||||
* @param[in] _name name of the object
|
||||
* @param[in] _value boolean value to add
|
||||
* @return false if an error occured
|
||||
*/
|
||||
bool AddBoolean(const etk::UString& _name, bool _value);
|
||||
/**
|
||||
* @brief Add a double element in the Object (automatic creation)
|
||||
* @param[in] _name name of the object
|
||||
* @param[in] _value double value to add
|
||||
* @return false if an error occured
|
||||
*/
|
||||
bool AddNumber(const etk::UString& _name, double _value);
|
||||
public: // herited function :
|
||||
virtual bool IParse(const etk::UString& _data, int32_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc);
|
||||
virtual bool IGenerate(etk::UString& _data, int32_t _indent) const;
|
||||
|
@ -34,12 +34,12 @@ namespace ejson
|
||||
* @brief Set the value of the node.
|
||||
* @param[in] _value New value of the node.
|
||||
*/
|
||||
void SetValue(const etk::UString& _value) { m_value = _value; };
|
||||
void Set(const etk::UString& _value) { m_value = _value; };
|
||||
/**
|
||||
* @brief Get the current element Value.
|
||||
* @return the reference of the string value.
|
||||
*/
|
||||
const etk::UString& GetValue(void) const { return m_value; };
|
||||
const etk::UString& Get(void) const { return m_value; };
|
||||
public: // herited function :
|
||||
virtual bool IParse(const etk::UString& _data, int32_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc);
|
||||
virtual bool IGenerate(etk::UString& _data, int32_t _indent) const;
|
||||
|
@ -130,7 +130,7 @@ namespace ejson
|
||||
* @param[in] current indentation of the file
|
||||
* @return false if an error occured.
|
||||
*/
|
||||
virtual bool IGenerate(etk::UString& _data, int32_t _indent) const { return true; };
|
||||
virtual bool IGenerate(etk::UString& _data, int32_t _indent) const = 0;
|
||||
public:
|
||||
/**
|
||||
* @brief Get the node type.
|
||||
|
@ -110,7 +110,7 @@ void Init(void)
|
||||
check.Set("test ejson::number", -2, "");
|
||||
l_list.PushBack(check);
|
||||
// ------------------------------------------------------
|
||||
reference = "{\n\t\"tmpElement\": 956256.000000\n}\n";
|
||||
reference = "{\n\t\"tmpElement\": 956256\n}\n";
|
||||
check.Set(reference,
|
||||
-1,
|
||||
"{ tmpElement:956256 }\n");
|
||||
@ -126,26 +126,37 @@ void Init(void)
|
||||
"tmpElement:956256\n");
|
||||
l_list.PushBack(check);
|
||||
// ------------------------------------------------------
|
||||
check.Set("{\n\t\"tmpElement\": 956256.000000\n}\n",
|
||||
check.Set("{\n\t\"tmpElement\": 956256\n}\n",
|
||||
-1,
|
||||
"{tmpElement:956256}\n");
|
||||
l_list.PushBack(check);
|
||||
// ------------------------------------------------------
|
||||
check.Set("{\n\t\"tmpElement\": -956256.000000\n}\n",
|
||||
check.Set("{\n\t\"tmpElement\": -956256\n}\n",
|
||||
-1,
|
||||
"{tmpElement:-956256}\n");
|
||||
l_list.PushBack(check);
|
||||
// ------------------------------------------------------
|
||||
check.Set("{\n\t\"tmpElement\": -956256.000000\n}\n",
|
||||
check.Set("{\n\t\"tmpElement\": -956256\n}\n",
|
||||
-1,
|
||||
"{tmpElement:-956256}\n");
|
||||
l_list.PushBack(check);
|
||||
// ------------------------------------------------------
|
||||
check.Set("{\n\t\"tmpElement\": -956.256000\n}\n",
|
||||
check.Set("{\n\t\"tmpElement\": -956.256\n}\n",
|
||||
-1,
|
||||
"{tmpElement:-956.256}\n");
|
||||
l_list.PushBack(check);
|
||||
|
||||
/*
|
||||
// ------------------------------------------------------
|
||||
check.Set("{\n\t\"tmpElement\": -956956544454621184\n}\n",
|
||||
-1,
|
||||
"{tmpElement:-956956544454621354.256}\n");
|
||||
l_list.PushBack(check);
|
||||
// ------------------------------------------------------
|
||||
check.Set("{\n\t\"tmpElement\": 0.000002\n}\n",
|
||||
-1,
|
||||
"{tmpElement:+.000001565464}\n");
|
||||
l_list.PushBack(check);
|
||||
*/
|
||||
|
||||
|
||||
// ======================================================
|
||||
@ -295,23 +306,23 @@ void Init(void)
|
||||
" \"window\": {\n"
|
||||
" \"title\": \"Sample Konfabulator Widget\",\n"
|
||||
" \"name\": \"main_window\",\n"
|
||||
" \"width\": 500.000000,\n"
|
||||
" \"height\": 500.000000\n"
|
||||
" \"width\": 500,\n"
|
||||
" \"height\": 500\n"
|
||||
" },\n"
|
||||
" \"image\": {\n"
|
||||
" \"src\": \"Images/Sun.png\",\n"
|
||||
" \"name\": \"sun1\",\n"
|
||||
" \"hOffset\": 250.000000,\n"
|
||||
" \"vOffset\": 250.000000,\n"
|
||||
" \"hOffset\": 250,\n"
|
||||
" \"vOffset\": 250,\n"
|
||||
" \"alignment\": \"center\"\n"
|
||||
" },\n"
|
||||
" \"text\": {\n"
|
||||
" \"data\": \"Click Here\",\n"
|
||||
" \"size\": 36.000000,\n"
|
||||
" \"size\": 36,\n"
|
||||
" \"style\": \"bold\",\n"
|
||||
" \"name\": \"text1\",\n"
|
||||
" \"hOffset\": 250.000000,\n"
|
||||
" \"vOffset\": 100.000000,\n"
|
||||
" \"hOffset\": 250,\n"
|
||||
" \"vOffset\": 100,\n"
|
||||
" \"alignment\": \"center\",\n"
|
||||
" \"onMouseUp\": \"sun1.opacity = (sun1.opacity / 100) * 90;\"\n"
|
||||
" }\n"
|
||||
@ -343,16 +354,16 @@ void Init(void)
|
||||
" \"useJSP\": false,\n"
|
||||
" \"jspListTemplate\": \"listTemplate.jsp\",\n"
|
||||
" \"jspFileTemplate\": \"articleTemplate.jsp\",\n"
|
||||
" \"cachePackageTagsTrack\": 200.000000,\n"
|
||||
" \"cachePackageTagsStore\": 200.000000,\n"
|
||||
" \"cachePackageTagsRefresh\": 60.000000,\n"
|
||||
" \"cacheTemplatesTrack\": 100.000000,\n"
|
||||
" \"cacheTemplatesStore\": 50.000000,\n"
|
||||
" \"cacheTemplatesRefresh\": 15.000000,\n"
|
||||
" \"cachePagesTrack\": 200.000000,\n"
|
||||
" \"cachePagesStore\": 100.000000,\n"
|
||||
" \"cachePagesRefresh\": 10.000000,\n"
|
||||
" \"cachePagesDirtyRead\": 10.000000,\n"
|
||||
" \"cachePackageTagsTrack\": 200,\n"
|
||||
" \"cachePackageTagsStore\": 200,\n"
|
||||
" \"cachePackageTagsRefresh\": 60,\n"
|
||||
" \"cacheTemplatesTrack\": 100,\n"
|
||||
" \"cacheTemplatesStore\": 50,\n"
|
||||
" \"cacheTemplatesRefresh\": 15,\n"
|
||||
" \"cachePagesTrack\": 200,\n"
|
||||
" \"cachePagesStore\": 100,\n"
|
||||
" \"cachePagesRefresh\": 10,\n"
|
||||
" \"cachePagesDirtyRead\": 10,\n"
|
||||
" \"searchEngineListTemplate\": \"forSearchEnginesList.htm\",\n"
|
||||
" \"searchEngineFileTemplate\": \"forSearchEngines.htm\",\n"
|
||||
" \"searchEngineRobotsDb\": \"WEB-INF/robots.db\",\n"
|
||||
@ -366,11 +377,11 @@ void Init(void)
|
||||
" \"dataStorePassword\": \"dataStoreTestQuery\",\n"
|
||||
" \"dataStoreTestQuery\": \"SET NOCOUNT ON;select test='test';\",\n"
|
||||
" \"dataStoreLogFile\": \"/usr/local/tomcat/logs/datastore.log\",\n"
|
||||
" \"dataStoreInitConns\": 10.000000,\n"
|
||||
" \"dataStoreMaxConns\": 100.000000,\n"
|
||||
" \"dataStoreConnUsageLimit\": 100.000000,\n"
|
||||
" \"dataStoreInitConns\": 10,\n"
|
||||
" \"dataStoreMaxConns\": 100,\n"
|
||||
" \"dataStoreConnUsageLimit\": 100,\n"
|
||||
" \"dataStoreLogLevel\": \"debug\",\n"
|
||||
" \"maxUrlLength\": 500.000000\n"
|
||||
" \"maxUrlLength\": 500\n"
|
||||
" }\n"
|
||||
" },\n"
|
||||
" {\n"
|
||||
@ -388,17 +399,17 @@ void Init(void)
|
||||
" \"servlet-class\": \"org.cofax.cms.CofaxToolsServlet\",\n"
|
||||
" \"init-param\": {\n"
|
||||
" \"templatePath\": \"toolstemplates/\",\n"
|
||||
" \"log\": 1.000000,\n"
|
||||
" \"log\": 1,\n"
|
||||
" \"logLocation\": \"/usr/local/tomcat/logs/CofaxTools.log\",\n"
|
||||
" \"logMaxSize\": \"\",\n"
|
||||
" \"dataLog\": 1.000000,\n"
|
||||
" \"dataLog\": 1,\n"
|
||||
" \"dataLogLocation\": \"/usr/local/tomcat/logs/dataLog.log\",\n"
|
||||
" \"dataLogMaxSize\": \"\",\n"
|
||||
" \"removePageCache\": \"/content/admin/remove?cache=pages&id=\",\n"
|
||||
" \"removeTemplateCache\": \"/content/admin/remove?cache=templates&id=\",\n"
|
||||
" \"fileTransferFolder\": \"/usr/local/tomcat/webapps/content/fileTransferFolder\",\n"
|
||||
" \"lookInContext\": 1.000000,\n"
|
||||
" \"adminGroupID\": 4.000000,\n"
|
||||
" \"lookInContext\": 1,\n"
|
||||
" \"adminGroupID\": 4,\n"
|
||||
" \"betaServer\": true\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
|
Loading…
x
Reference in New Issue
Block a user