From 70ec065ec344f753561a4b83ecc64582dc5efb46 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 24 Oct 2013 21:07:26 +0200 Subject: [PATCH] [DEV] coding style review --- ejson/Array.h | 32 ++++++++++++++++++++++++-------- ejson/Boolean.cpp | 1 + ejson/Boolean.h | 29 ++++++++++++++++++++++------- ejson/Object.h | 12 +++++++++--- 4 files changed, 56 insertions(+), 18 deletions(-) diff --git a/ejson/Array.h b/ejson/Array.h index 208cddb..6c68e75 100644 --- a/ejson/Array.h +++ b/ejson/Array.h @@ -22,11 +22,15 @@ namespace ejson /** * @brief basic element of a xml structure */ - Array(void) { }; + Array(void) { + + }; /** * @brief destructor */ - virtual ~Array(void) { }; + virtual ~Array(void) { + + }; private: etk::Vector m_value; //!< vector of sub elements public: @@ -34,14 +38,20 @@ namespace ejson * @brief get the number of sub element in the current one * @return the Number of stored element */ - esize_t size(void) const { return m_value.size(); }; + esize_t size(void) const { + return m_value.size(); + }; /** * @brief get the pointer on an element reference with his ID. * @param[in] _id Id of the element. * @return NULL if the element does not exist. */ - const ejson::Value* get(esize_t _id) const { return m_value[_id]; }; - ejson::Value* get(esize_t _id) { return m_value[_id]; }; + const ejson::Value* get(esize_t _id) const { + return m_value[_id]; + }; + ejson::Value* get(esize_t _id) { + return m_value[_id]; + }; /** * @brief get the pointer on an element reference with his ID (casted in Object if it is an object). * @param[in] _id Id of the element. @@ -138,9 +148,15 @@ namespace ejson 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; - virtual nodeType_te getType(void) const { return typeArray; }; - virtual ejson::Array* toArray(void) { return this; }; - virtual const ejson::Array* toArray(void) const{ return this; }; + virtual nodeType_te getType(void) const { + return typeArray; + }; + virtual ejson::Array* toArray(void) { + return this; + }; + virtual const ejson::Array* toArray(void) const { + return this; + }; virtual void clear(void); virtual bool transfertIn(ejson::Value* _obj); virtual ejson::Value* duplicate(void) const; diff --git a/ejson/Boolean.cpp b/ejson/Boolean.cpp index feba4e8..496c88b 100644 --- a/ejson/Boolean.cpp +++ b/ejson/Boolean.cpp @@ -15,6 +15,7 @@ bool ejson::Boolean::iParse(const etk::UString& _data, int32_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc) { JSON_PARSE_ELEMENT("start parse : 'Boolean' "); + m_value=false; if( _data[_pos] == 't' && _pos+3 < _data.size() && _data[_pos+1] == 'r' diff --git a/ejson/Boolean.h b/ejson/Boolean.h index fe6415f..58b573b 100644 --- a/ejson/Boolean.h +++ b/ejson/Boolean.h @@ -22,11 +22,16 @@ namespace ejson /** * @brief basic element of a xml structure */ - Boolean(bool _value=false) : m_value(_value) { }; + Boolean(bool _value=false) : + m_value(_value) { + + }; /** * @brief destructor */ - virtual ~Boolean(void) { }; + virtual ~Boolean(void) { + + }; protected: bool m_value; //!< value of the node public: @@ -34,18 +39,28 @@ namespace ejson * @brief set the value of the node. * @param[in] _value New value of the node. */ - void set(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 get(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; - virtual nodeType_te getType(void) const { return typeString; }; - virtual ejson::Boolean* toBoolean(void) { return this; }; - virtual const ejson::Boolean* toBoolean(void) const{ return this; }; + virtual nodeType_te getType(void) const { + return typeString; + }; + virtual ejson::Boolean* toBoolean(void) { + return this; + }; + virtual const ejson::Boolean* toBoolean(void) const{ + return this; + }; virtual bool transfertIn(ejson::Value* _obj); virtual ejson::Value* duplicate(void) const; }; diff --git a/ejson/Object.h b/ejson/Object.h index a84d5d7..b01ab5c 100644 --- a/ejson/Object.h +++ b/ejson/Object.h @@ -144,9 +144,15 @@ namespace ejson 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; - virtual nodeType_te getType(void) const { return typeObject; }; - virtual ejson::Object* toObject(void) { return this; }; - virtual const ejson::Object* toObject(void) const{ return this; }; + virtual nodeType_te getType(void) const { + return typeObject; + }; + virtual ejson::Object* toObject(void) { + return this; + }; + virtual const ejson::Object* toObject(void) const{ + return this; + }; virtual void clear(void); virtual bool transfertIn(ejson::Value* _obj); virtual ejson::Value* duplicate(void) const;