[DEV] coding style review

This commit is contained in:
Edouard DUPIN 2013-10-24 21:07:26 +02:00
parent b442284f09
commit 70ec065ec3
4 changed files with 56 additions and 18 deletions

View File

@ -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<ejson::Value*> 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;

View File

@ -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'

View File

@ -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;
};

View File

@ -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;