From 77ff2747bb6b82555947e59ee6171e44eeb85db6 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 15 May 2014 21:37:39 +0200 Subject: [PATCH] [STYLE] remove (void) in () to be c++ coherent --- ejson/Array.cpp | 6 ++-- ejson/Array.h | 12 ++++---- ejson/Boolean.cpp | 2 +- ejson/Boolean.h | 6 ++-- ejson/Null.cpp | 2 +- ejson/Null.h | 6 ++-- ejson/Number.cpp | 2 +- ejson/Number.h | 10 +++---- ejson/Object.cpp | 4 +-- ejson/Object.h | 12 ++++---- ejson/String.cpp | 2 +- ejson/String.h | 6 ++-- ejson/Value.cpp | 30 ++++++++++---------- ejson/Value.h | 70 +++++++++++++++++++++++------------------------ ejson/debug.cpp | 2 +- ejson/debug.h | 2 +- ejson/ejson.cpp | 8 +++--- ejson/ejson.h | 12 ++++---- ejson/test.cpp | 4 +-- 19 files changed, 99 insertions(+), 99 deletions(-) diff --git a/ejson/Array.cpp b/ejson/Array.cpp index 2622a62..fabc635 100644 --- a/ejson/Array.cpp +++ b/ejson/Array.cpp @@ -20,7 +20,7 @@ #define __class__ "Array" -void ejson::Array::clear(void) { +void ejson::Array::clear() { for (size_t iii=0; iii m_value; //!< vector of sub elements public: @@ -30,7 +30,7 @@ namespace ejson { * @brief get the number of sub element in the current one * @return the Number of stored element */ - size_t size(void) const { + size_t size() const { return m_value.size(); }; /** @@ -146,7 +146,7 @@ namespace ejson { * @brief add a "null" element in the Object (automatic creation) * @return false if an error occured */ - bool addNull(void); + bool addNull(); /** * @brief add a boolean element in the Object (automatic creation) * @param[in] _value boolean value to add @@ -163,9 +163,9 @@ namespace ejson { public: // herited function : virtual bool iParse(const std::string& _data, size_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc); virtual bool iGenerate(std::string& _data, size_t _indent) const; - virtual void clear(void); + virtual void clear(); virtual bool transfertIn(ejson::Value* _obj); - virtual ejson::Value* duplicate(void) const; + virtual ejson::Value* duplicate() const; }; }; diff --git a/ejson/Boolean.cpp b/ejson/Boolean.cpp index 724c49f..c87d0ea 100644 --- a/ejson/Boolean.cpp +++ b/ejson/Boolean.cpp @@ -68,7 +68,7 @@ bool ejson::Boolean::transfertIn(ejson::Value* _obj) { return true; } -ejson::Value* ejson::Boolean::duplicate(void) const { +ejson::Value* ejson::Boolean::duplicate() const { ejson::Boolean* output = new ejson::Boolean(m_value); if (NULL == output) { JSON_ERROR("Allocation error ..."); diff --git a/ejson/Boolean.h b/ejson/Boolean.h index d742e51..63d2011 100755 --- a/ejson/Boolean.h +++ b/ejson/Boolean.h @@ -25,7 +25,7 @@ namespace ejson { /** * @brief destructor */ - virtual ~Boolean(void) { + virtual ~Boolean() { }; protected: @@ -42,14 +42,14 @@ namespace ejson { * @brief get the current element Value. * @return the reference of the string value. */ - bool get(void) const { + bool get() const { return m_value; }; public: // herited function : virtual bool iParse(const std::string& _data, size_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc); virtual bool iGenerate(std::string& _data, size_t _indent) const; virtual bool transfertIn(ejson::Value* _obj); - virtual ejson::Value* duplicate(void) const; + virtual ejson::Value* duplicate() const; }; }; diff --git a/ejson/Null.cpp b/ejson/Null.cpp index d785410..f4acb94 100644 --- a/ejson/Null.cpp +++ b/ejson/Null.cpp @@ -52,7 +52,7 @@ bool ejson::Null::transfertIn(ejson::Value* _obj) { return true; } -ejson::Value* ejson::Null::duplicate(void) const { +ejson::Value* ejson::Null::duplicate() const { ejson::Null* output = new ejson::Null(); if (NULL == output) { JSON_ERROR("Allocation error ..."); diff --git a/ejson/Null.h b/ejson/Null.h index 12d68e0..1a1bd25 100755 --- a/ejson/Null.h +++ b/ejson/Null.h @@ -18,16 +18,16 @@ namespace ejson { /** * @brief basic element of a xml structure */ - Null(void) { }; + Null() { }; /** * @brief destructor */ - virtual ~Null(void) { }; + virtual ~Null() { }; public: // herited function : virtual bool iParse(const std::string& _data, size_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc); virtual bool iGenerate(std::string& _data, size_t _indent) const; virtual bool transfertIn(ejson::Value* _obj); - virtual ejson::Value* duplicate(void) const; + virtual ejson::Value* duplicate() const; }; }; diff --git a/ejson/Number.cpp b/ejson/Number.cpp index 58f30b0..4a83b62 100644 --- a/ejson/Number.cpp +++ b/ejson/Number.cpp @@ -65,7 +65,7 @@ bool ejson::Number::transfertIn(ejson::Value* _obj) { return true; } -ejson::Value* ejson::Number::duplicate(void) const { +ejson::Value* ejson::Number::duplicate() const { ejson::Number* output = new ejson::Number(m_value); if (NULL == output) { JSON_ERROR("Allocation error ..."); diff --git a/ejson/Number.h b/ejson/Number.h index 038229a..336b5a1 100755 --- a/ejson/Number.h +++ b/ejson/Number.h @@ -25,7 +25,7 @@ namespace ejson { /** * @brief destructor */ - virtual ~Number(void) { }; + virtual ~Number() { }; protected: double m_value; //!< value of the node public: @@ -40,28 +40,28 @@ namespace ejson { * @brief Get the current element Value. * @return The double number registered */ - double get(void) const { + double get() const { return m_value; }; /** * @brief Get the current element Value. * @return The 32 bit integer number registered */ - int32_t getInt32(void) const { + int32_t getInt32() const { return (int32_t)m_value; }; /** * @brief Get the current element Value. * @return The 64 bit integer number registered */ - int64_t getInt64(void) const { + int64_t getInt64() const { return (int64_t)m_value; }; public: // herited function : virtual bool iParse(const std::string& _data, size_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc); virtual bool iGenerate(std::string& _data, size_t _indent) const; virtual bool transfertIn(ejson::Value* _obj); - virtual ejson::Value* duplicate(void) const; + virtual ejson::Value* duplicate() const; }; }; diff --git a/ejson/Object.cpp b/ejson/Object.cpp index 3edfd26..babe0f8 100644 --- a/ejson/Object.cpp +++ b/ejson/Object.cpp @@ -19,7 +19,7 @@ #undef __class__ #define __class__ "Object" -void ejson::Object::clear(void) { +void ejson::Object::clear() { for(auto &it : m_value) { if (it.second == NULL) { continue; @@ -492,7 +492,7 @@ bool ejson::Object::transfertIn(ejson::Value* _obj) { } // TODO : Manage error ... -ejson::Value* ejson::Object::duplicate(void) const { +ejson::Value* ejson::Object::duplicate() const { ejson::Object* output = new ejson::Object(); if (NULL == output) { JSON_ERROR("Allocation error ..."); diff --git a/ejson/Object.h b/ejson/Object.h index 5a1cc14..4046516 100755 --- a/ejson/Object.h +++ b/ejson/Object.h @@ -20,11 +20,11 @@ namespace ejson { /** * @brief basic element of a xml structure */ - Object(void) { }; + Object() { }; /** * @brief destructor */ - virtual ~Object(void) { }; + virtual ~Object() { }; protected: std::map m_value; //!< value of the node (for element this is the name, for text it is the inside text ...) public: @@ -56,7 +56,7 @@ namespace ejson { * @brief Get all the element name (keys). * @return a vector of all name (key). */ - std::vector getKeys(void) const { + std::vector getKeys() const { std::vector keys; for (auto &it : m_value) { keys.push_back(it.first); @@ -67,7 +67,7 @@ namespace ejson { * @brief get the number of sub element in the current one * @return the Number of stored element */ - size_t size(void) const { + size_t size() const { return m_value.size(); }; /** @@ -231,9 +231,9 @@ namespace ejson { public: // herited function : virtual bool iParse(const std::string& _data, size_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc); virtual bool iGenerate(std::string& _data, size_t _indent) const; - virtual void clear(void); + virtual void clear(); virtual bool transfertIn(ejson::Value* _obj); - virtual ejson::Value* duplicate(void) const; + virtual ejson::Value* duplicate() const; }; }; diff --git a/ejson/String.cpp b/ejson/String.cpp index 25bea20..64d2b34 100644 --- a/ejson/String.cpp +++ b/ejson/String.cpp @@ -63,7 +63,7 @@ bool ejson::String::transfertIn(ejson::Value* _obj) { return true; } -ejson::Value* ejson::String::duplicate(void) const { +ejson::Value* ejson::String::duplicate() const { ejson::String* output = new ejson::String(m_value); if (NULL == output) { JSON_ERROR("Allocation error ..."); diff --git a/ejson/String.h b/ejson/String.h index 5bc06ad..50aefe9 100755 --- a/ejson/String.h +++ b/ejson/String.h @@ -25,7 +25,7 @@ namespace ejson { /** * @brief destructor */ - virtual ~String(void) { }; + virtual ~String() { }; protected: std::string m_value; //!< value of the node (for element this is the name, for text it is the inside text ...) public: @@ -40,14 +40,14 @@ namespace ejson { * @brief get the current element Value. * @return the reference of the string value. */ - const std::string& get(void) const { + const std::string& get() const { return m_value; }; public: // herited function : virtual bool iParse(const std::string& _data, size_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc); virtual bool iGenerate(std::string& _data, size_t _indent) const; virtual bool transfertIn(ejson::Value* _obj); - virtual ejson::Value* duplicate(void) const; + virtual ejson::Value* duplicate() const; }; }; diff --git a/ejson/Value.cpp b/ejson/Value.cpp index e02ea98..8466bbf 100644 --- a/ejson/Value.cpp +++ b/ejson/Value.cpp @@ -15,7 +15,7 @@ -ejson::Value::~Value(void) { +ejson::Value::~Value() { clear(); } @@ -124,45 +124,45 @@ bool ejson::Value::checkNumber(char32_t _val) const { } -ejson::Document* ejson::Value::toDocument(void) { +ejson::Document* ejson::Value::toDocument() { return dynamic_cast(this); }; -const ejson::Document* ejson::Value::toDocument(void) const { +const ejson::Document* ejson::Value::toDocument() const { return dynamic_cast(this); }; -ejson::Array* ejson::Value::toArray(void) { +ejson::Array* ejson::Value::toArray() { return dynamic_cast(this); }; -const ejson::Array* ejson::Value::toArray(void) const{ +const ejson::Array* ejson::Value::toArray() const{ return dynamic_cast(this); }; -ejson::Object* ejson::Value::toObject(void) { +ejson::Object* ejson::Value::toObject() { return dynamic_cast(this); }; -const ejson::Object* ejson::Value::toObject(void) const{ +const ejson::Object* ejson::Value::toObject() const{ return dynamic_cast(this); }; -ejson::String* ejson::Value::toString(void) { +ejson::String* ejson::Value::toString() { return dynamic_cast(this); }; -const ejson::String* ejson::Value::toString(void) const{ +const ejson::String* ejson::Value::toString() const{ return dynamic_cast(this); }; -ejson::Number* ejson::Value::toNumber(void) { +ejson::Number* ejson::Value::toNumber() { return dynamic_cast(this); }; -const ejson::Number* ejson::Value::toNumber(void) const{ +const ejson::Number* ejson::Value::toNumber() const{ return dynamic_cast(this); }; -ejson::Boolean* ejson::Value::toBoolean(void) { +ejson::Boolean* ejson::Value::toBoolean() { return dynamic_cast(this); }; -const ejson::Boolean* ejson::Value::toBoolean(void) const{ +const ejson::Boolean* ejson::Value::toBoolean() const{ return dynamic_cast(this); }; -ejson::Null* ejson::Value::toNull(void) { +ejson::Null* ejson::Value::toNull() { return dynamic_cast(this); }; -const ejson::Null* ejson::Value::toNull(void) const{ +const ejson::Null* ejson::Value::toNull() const{ return dynamic_cast(this); }; \ No newline at end of file diff --git a/ejson/Value.h b/ejson/Value.h index b9c415d..e209ac2 100755 --- a/ejson/Value.h +++ b/ejson/Value.h @@ -36,7 +36,7 @@ namespace ejson { size_t m_col; size_t m_line; public: - filePos(void) : + filePos() : m_col(0), m_line(0) { @@ -46,12 +46,12 @@ namespace ejson { m_line(_line) { }; - ~filePos(void) { }; - filePos& operator ++(void) { + ~filePos() { }; + filePos& operator ++() { m_col++; return *this; }; - filePos& operator --(void) { + filePos& operator --() { if(m_col>0) { m_col--; } @@ -75,7 +75,7 @@ namespace ejson { m_line = _obj.m_line; return *this; } - void newLine(void) { + void newLine() { m_col=0; m_line++; }; @@ -91,14 +91,14 @@ namespace ejson { m_col = _col; m_line = _line; } - void clear(void) { + void clear() { m_col = 0; m_line = 0; } - int32_t getCol(void) const { + int32_t getCol() const { return m_col; }; - int32_t getLine(void) const { + int32_t getLine() const { return m_line; }; }; @@ -109,11 +109,11 @@ namespace ejson { /** * @brief basic element of a xml structure */ - Value(void) { }; + Value() { }; /** * @brief destructor */ - virtual ~Value(void); + virtual ~Value(); public: /** * @brief parse the Current node [pure VIRUAL] @@ -167,117 +167,117 @@ namespace ejson { * @brief Cast the element in a Value if it is possible. * @return pointer on the class or NULL. */ - ejson::Value* toValue(void) { + ejson::Value* toValue() { return this; }; //! @previous - const ejson::Value* toValue(void) const { + const ejson::Value* toValue() const { return this; }; /** * @brief Cast the element in a Document if it is possible. * @return pointer on the class or NULL. */ - ejson::Document* toDocument(void); + ejson::Document* toDocument(); //! @previous - const ejson::Document* toDocument(void) const; + const ejson::Document* toDocument() const; /** * @brief Cast the element in a Array if it is possible. * @return pointer on the class or NULL. */ - ejson::Array* toArray(void); + ejson::Array* toArray(); //! @previous - const ejson::Array* toArray(void) const; + const ejson::Array* toArray() const; /** * @brief Cast the element in a Object if it is possible. * @return pointer on the class or NULL. */ - ejson::Object* toObject(void); + ejson::Object* toObject(); //! @previous - const ejson::Object* toObject(void) const; + const ejson::Object* toObject() const; /** * @brief Cast the element in a String if it is possible. * @return pointer on the class or NULL. */ - ejson::String* toString(void); + ejson::String* toString(); //! @previous - const ejson::String* toString(void) const; + const ejson::String* toString() const; /** * @brief Cast the element in a Number if it is possible. * @return pointer on the class or NULL. */ - ejson::Number* toNumber(void); + ejson::Number* toNumber(); //! @previous - const ejson::Number* toNumber(void) const; + const ejson::Number* toNumber() const; /** * @brief Cast the element in a Boolean if it is possible. * @return pointer on the class or NULL. */ - ejson::Boolean* toBoolean(void); + ejson::Boolean* toBoolean(); //! @previous - const ejson::Boolean* toBoolean(void) const; + const ejson::Boolean* toBoolean() const; /** * @brief Cast the element in a Null if it is possible. * @return pointer on the class or NULL. */ - ejson::Null* toNull(void); + ejson::Null* toNull(); //! @previous - const ejson::Null* toNull(void) const; + const ejson::Null* toNull() const; /** * @brief check if the node is a ejson::Document * @return true if the node is a ejson::Document */ - bool isDocument(void) const { + bool isDocument() const { return toDocument() != NULL; }; /** * @brief check if the node is a ejson::Array * @return true if the node is a ejson::Array */ - bool isArray(void) const { + bool isArray() const { return toArray() != NULL; }; /** * @brief check if the node is a ejson::Object * @return true if the node is a ejson::Object */ - bool isObject(void) const { + bool isObject() const { return toObject() != NULL; }; /** * @brief check if the node is a ejson::String * @return true if the node is a ejson::String */ - bool isString(void) const { + bool isString() const { return toString() != NULL; }; /** * @brief check if the node is a ejson::Number * @return true if the node is a ejson::Number */ - bool isNumber(void) const { + bool isNumber() const { return toNumber() != NULL; }; /** * @brief check if the node is a ejson::Boolean * @return true if the node is a ejson::Boolean */ - bool isBoolean(void) const { + bool isBoolean() const { return toBoolean() != NULL; }; /** * @brief check if the node is a ejson::Null * @return true if the node is a ejson::Null */ - bool isNull(void) const { + bool isNull() const { return toNull() != NULL; }; /** * @brief clear the Node */ - virtual void clear(void) {}; + virtual void clear() {}; /** * @brief Tranfert all element in the element set in parameter * @param[in,out] _obj move all parameter in the selected element @@ -291,7 +291,7 @@ namespace ejson { * @brief Copy the curent node and all the child in the curent one. * @return NULL in an error occured, the pointer on the element otherwise */ - virtual ejson::Value* duplicate(void) const { + virtual ejson::Value* duplicate() const { return NULL; }; protected: diff --git a/ejson/debug.cpp b/ejson/debug.cpp index d90febf..ef7c94c 100644 --- a/ejson/debug.cpp +++ b/ejson/debug.cpp @@ -8,7 +8,7 @@ #include -int32_t ejson::getLogId(void) { +int32_t ejson::getLogId() { static int32_t g_val = etk::log::registerInstance("ejson"); return g_val; } diff --git a/ejson/debug.h b/ejson/debug.h index 838d3c1..47831da 100644 --- a/ejson/debug.h +++ b/ejson/debug.h @@ -12,7 +12,7 @@ #include namespace ejson { - int32_t getLogId(void); + int32_t getLogId(); }; // TODO : Review this problem of multiple intanciation of "std::stringbuf sb" #define JSON_BASE(info,data) \ diff --git a/ejson/ejson.cpp b/ejson/ejson.cpp index 374aae4..a0b7d3a 100644 --- a/ejson/ejson.cpp +++ b/ejson/ejson.cpp @@ -20,7 +20,7 @@ #undef __class__ #define __class__ "Document" -ejson::Document::Document(void) : +ejson::Document::Document() : m_writeErrorWhenDetexted(true), m_comment(""), m_Line(""), @@ -28,7 +28,7 @@ ejson::Document::Document(void) : } -ejson::Document::~Document(void) { +ejson::Document::~Document() { } @@ -111,7 +111,7 @@ bool ejson::Document::store(const std::string& _file) { return true; } -void ejson::Document::display(void) { +void ejson::Document::display() { std::string tmpp; iGenerate(tmpp, 0); JSON_INFO("Generated JSON : \n" << tmpp); @@ -134,7 +134,7 @@ static std::string createPosPointer(const std::string& _line, size_t _pos) { return out; } -void ejson::Document::displayError(void) { +void ejson::Document::displayError() { if (m_comment.size() == 0) { JSON_ERROR("No error detected ???"); return; diff --git a/ejson/ejson.h b/ejson/ejson.h index 12dc197..3171d64 100755 --- a/ejson/ejson.h +++ b/ejson/ejson.h @@ -22,11 +22,11 @@ namespace ejson { /** * @brief Constructor */ - Document(void); + Document(); /** * @brief Destructor */ - virtual ~Document(void); + virtual ~Document(); public: /** * @brief parse a string that contain an XML @@ -59,22 +59,22 @@ namespace ejson { /** * @brief Display the Document on console */ - void display(void); + void display(); private: bool m_writeErrorWhenDetexted; std::string m_comment; std::string m_Line; ejson::filePos m_filePos; public: - void displayErrorWhenDetected(void) { + void displayErrorWhenDetected() { m_writeErrorWhenDetexted=true; }; - void notDisplayErrorWhenDetected(void) { + void notDisplayErrorWhenDetected() { m_writeErrorWhenDetexted=false; }; void createError(const std::string& _data, size_t _pos, const ejson::filePos& _filePos, const std::string& _comment); - void displayError(void); + void displayError(); public: // herited function: virtual bool iParse(const std::string& _data, size_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc); virtual bool iGenerate(std::string& _data, size_t _indent) const; diff --git a/ejson/test.cpp b/ejson/test.cpp index e0f843f..e1554ca 100644 --- a/ejson/test.cpp +++ b/ejson/test.cpp @@ -19,7 +19,7 @@ class testCheck { std::string m_ref; std::string m_input; int32_t m_errorPos; // -1 : no error , 1 : parsing error, 2 generation error, 3 comparaison error ???? - testCheck(void) {}; + testCheck() {}; void set(const std::string& _ref, int32_t _pos, const std::string& _input) { m_ref = _ref; m_input = _input; @@ -29,7 +29,7 @@ class testCheck { std::vector l_list; -void init(void) { +void init() { std::string reference; std::string input; testCheck check;