[STYLE] remove (void) in () to be c++ coherent
This commit is contained in:
parent
86116be4db
commit
77ff2747bb
@ -20,7 +20,7 @@
|
|||||||
#define __class__ "Array"
|
#define __class__ "Array"
|
||||||
|
|
||||||
|
|
||||||
void ejson::Array::clear(void) {
|
void ejson::Array::clear() {
|
||||||
for (size_t iii=0; iii<m_value.size(); ++iii) {
|
for (size_t iii=0; iii<m_value.size(); ++iii) {
|
||||||
if (NULL == m_value[iii]) {
|
if (NULL == m_value[iii]) {
|
||||||
continue;
|
continue;
|
||||||
@ -201,7 +201,7 @@ bool ejson::Array::addString(const std::string& _value) {
|
|||||||
return add(new ejson::String(_value));
|
return add(new ejson::String(_value));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ejson::Array::addNull(void) {
|
bool ejson::Array::addNull() {
|
||||||
return add(new ejson::Null());
|
return add(new ejson::Null());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ bool ejson::Array::transfertIn(ejson::Value* _obj) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO : Manage error ...
|
// TODO : Manage error ...
|
||||||
ejson::Value* ejson::Array::duplicate(void) const {
|
ejson::Value* ejson::Array::duplicate() const {
|
||||||
ejson::Array* output = new ejson::Array();
|
ejson::Array* output = new ejson::Array();
|
||||||
if (NULL == output) {
|
if (NULL == output) {
|
||||||
JSON_ERROR("Allocation error ...");
|
JSON_ERROR("Allocation error ...");
|
||||||
|
@ -18,11 +18,11 @@ namespace ejson {
|
|||||||
/**
|
/**
|
||||||
* @brief basic element of a xml structure
|
* @brief basic element of a xml structure
|
||||||
*/
|
*/
|
||||||
Array(void) { };
|
Array() { };
|
||||||
/**
|
/**
|
||||||
* @brief destructor
|
* @brief destructor
|
||||||
*/
|
*/
|
||||||
virtual ~Array(void) { };
|
virtual ~Array() { };
|
||||||
private:
|
private:
|
||||||
std::vector<ejson::Value*> m_value; //!< vector of sub elements
|
std::vector<ejson::Value*> m_value; //!< vector of sub elements
|
||||||
public:
|
public:
|
||||||
@ -30,7 +30,7 @@ namespace ejson {
|
|||||||
* @brief get the number of sub element in the current one
|
* @brief get the number of sub element in the current one
|
||||||
* @return the Number of stored element
|
* @return the Number of stored element
|
||||||
*/
|
*/
|
||||||
size_t size(void) const {
|
size_t size() const {
|
||||||
return m_value.size();
|
return m_value.size();
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@ -146,7 +146,7 @@ namespace ejson {
|
|||||||
* @brief add a "null" element in the Object (automatic creation)
|
* @brief add a "null" element in the Object (automatic creation)
|
||||||
* @return false if an error occured
|
* @return false if an error occured
|
||||||
*/
|
*/
|
||||||
bool addNull(void);
|
bool addNull();
|
||||||
/**
|
/**
|
||||||
* @brief add a boolean element in the Object (automatic creation)
|
* @brief add a boolean element in the Object (automatic creation)
|
||||||
* @param[in] _value boolean value to add
|
* @param[in] _value boolean value to add
|
||||||
@ -163,9 +163,9 @@ namespace ejson {
|
|||||||
public: // herited function :
|
public: // herited function :
|
||||||
virtual bool iParse(const std::string& _data, size_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc);
|
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 iGenerate(std::string& _data, size_t _indent) const;
|
||||||
virtual void clear(void);
|
virtual void clear();
|
||||||
virtual bool transfertIn(ejson::Value* _obj);
|
virtual bool transfertIn(ejson::Value* _obj);
|
||||||
virtual ejson::Value* duplicate(void) const;
|
virtual ejson::Value* duplicate() const;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ bool ejson::Boolean::transfertIn(ejson::Value* _obj) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ejson::Value* ejson::Boolean::duplicate(void) const {
|
ejson::Value* ejson::Boolean::duplicate() const {
|
||||||
ejson::Boolean* output = new ejson::Boolean(m_value);
|
ejson::Boolean* output = new ejson::Boolean(m_value);
|
||||||
if (NULL == output) {
|
if (NULL == output) {
|
||||||
JSON_ERROR("Allocation error ...");
|
JSON_ERROR("Allocation error ...");
|
||||||
|
@ -25,7 +25,7 @@ namespace ejson {
|
|||||||
/**
|
/**
|
||||||
* @brief destructor
|
* @brief destructor
|
||||||
*/
|
*/
|
||||||
virtual ~Boolean(void) {
|
virtual ~Boolean() {
|
||||||
|
|
||||||
};
|
};
|
||||||
protected:
|
protected:
|
||||||
@ -42,14 +42,14 @@ namespace ejson {
|
|||||||
* @brief get the current element Value.
|
* @brief get the current element Value.
|
||||||
* @return the reference of the string value.
|
* @return the reference of the string value.
|
||||||
*/
|
*/
|
||||||
bool get(void) const {
|
bool get() const {
|
||||||
return m_value;
|
return m_value;
|
||||||
};
|
};
|
||||||
public: // herited function :
|
public: // herited function :
|
||||||
virtual bool iParse(const std::string& _data, size_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc);
|
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 iGenerate(std::string& _data, size_t _indent) const;
|
||||||
virtual bool transfertIn(ejson::Value* _obj);
|
virtual bool transfertIn(ejson::Value* _obj);
|
||||||
virtual ejson::Value* duplicate(void) const;
|
virtual ejson::Value* duplicate() const;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ bool ejson::Null::transfertIn(ejson::Value* _obj) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ejson::Value* ejson::Null::duplicate(void) const {
|
ejson::Value* ejson::Null::duplicate() const {
|
||||||
ejson::Null* output = new ejson::Null();
|
ejson::Null* output = new ejson::Null();
|
||||||
if (NULL == output) {
|
if (NULL == output) {
|
||||||
JSON_ERROR("Allocation error ...");
|
JSON_ERROR("Allocation error ...");
|
||||||
|
@ -18,16 +18,16 @@ namespace ejson {
|
|||||||
/**
|
/**
|
||||||
* @brief basic element of a xml structure
|
* @brief basic element of a xml structure
|
||||||
*/
|
*/
|
||||||
Null(void) { };
|
Null() { };
|
||||||
/**
|
/**
|
||||||
* @brief destructor
|
* @brief destructor
|
||||||
*/
|
*/
|
||||||
virtual ~Null(void) { };
|
virtual ~Null() { };
|
||||||
public: // herited function :
|
public: // herited function :
|
||||||
virtual bool iParse(const std::string& _data, size_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc);
|
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 iGenerate(std::string& _data, size_t _indent) const;
|
||||||
virtual bool transfertIn(ejson::Value* _obj);
|
virtual bool transfertIn(ejson::Value* _obj);
|
||||||
virtual ejson::Value* duplicate(void) const;
|
virtual ejson::Value* duplicate() const;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ bool ejson::Number::transfertIn(ejson::Value* _obj) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ejson::Value* ejson::Number::duplicate(void) const {
|
ejson::Value* ejson::Number::duplicate() const {
|
||||||
ejson::Number* output = new ejson::Number(m_value);
|
ejson::Number* output = new ejson::Number(m_value);
|
||||||
if (NULL == output) {
|
if (NULL == output) {
|
||||||
JSON_ERROR("Allocation error ...");
|
JSON_ERROR("Allocation error ...");
|
||||||
|
@ -25,7 +25,7 @@ namespace ejson {
|
|||||||
/**
|
/**
|
||||||
* @brief destructor
|
* @brief destructor
|
||||||
*/
|
*/
|
||||||
virtual ~Number(void) { };
|
virtual ~Number() { };
|
||||||
protected:
|
protected:
|
||||||
double m_value; //!< value of the node
|
double m_value; //!< value of the node
|
||||||
public:
|
public:
|
||||||
@ -40,28 +40,28 @@ namespace ejson {
|
|||||||
* @brief Get the current element Value.
|
* @brief Get the current element Value.
|
||||||
* @return The double number registered
|
* @return The double number registered
|
||||||
*/
|
*/
|
||||||
double get(void) const {
|
double get() const {
|
||||||
return m_value;
|
return m_value;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief Get the current element Value.
|
* @brief Get the current element Value.
|
||||||
* @return The 32 bit integer number registered
|
* @return The 32 bit integer number registered
|
||||||
*/
|
*/
|
||||||
int32_t getInt32(void) const {
|
int32_t getInt32() const {
|
||||||
return (int32_t)m_value;
|
return (int32_t)m_value;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief Get the current element Value.
|
* @brief Get the current element Value.
|
||||||
* @return The 64 bit integer number registered
|
* @return The 64 bit integer number registered
|
||||||
*/
|
*/
|
||||||
int64_t getInt64(void) const {
|
int64_t getInt64() const {
|
||||||
return (int64_t)m_value;
|
return (int64_t)m_value;
|
||||||
};
|
};
|
||||||
public: // herited function :
|
public: // herited function :
|
||||||
virtual bool iParse(const std::string& _data, size_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc);
|
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 iGenerate(std::string& _data, size_t _indent) const;
|
||||||
virtual bool transfertIn(ejson::Value* _obj);
|
virtual bool transfertIn(ejson::Value* _obj);
|
||||||
virtual ejson::Value* duplicate(void) const;
|
virtual ejson::Value* duplicate() const;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "Object"
|
#define __class__ "Object"
|
||||||
|
|
||||||
void ejson::Object::clear(void) {
|
void ejson::Object::clear() {
|
||||||
for(auto &it : m_value) {
|
for(auto &it : m_value) {
|
||||||
if (it.second == NULL) {
|
if (it.second == NULL) {
|
||||||
continue;
|
continue;
|
||||||
@ -492,7 +492,7 @@ bool ejson::Object::transfertIn(ejson::Value* _obj) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO : Manage error ...
|
// TODO : Manage error ...
|
||||||
ejson::Value* ejson::Object::duplicate(void) const {
|
ejson::Value* ejson::Object::duplicate() const {
|
||||||
ejson::Object* output = new ejson::Object();
|
ejson::Object* output = new ejson::Object();
|
||||||
if (NULL == output) {
|
if (NULL == output) {
|
||||||
JSON_ERROR("Allocation error ...");
|
JSON_ERROR("Allocation error ...");
|
||||||
|
@ -20,11 +20,11 @@ namespace ejson {
|
|||||||
/**
|
/**
|
||||||
* @brief basic element of a xml structure
|
* @brief basic element of a xml structure
|
||||||
*/
|
*/
|
||||||
Object(void) { };
|
Object() { };
|
||||||
/**
|
/**
|
||||||
* @brief destructor
|
* @brief destructor
|
||||||
*/
|
*/
|
||||||
virtual ~Object(void) { };
|
virtual ~Object() { };
|
||||||
protected:
|
protected:
|
||||||
std::map<std::string, ejson::Value*> m_value; //!< value of the node (for element this is the name, for text it is the inside text ...)
|
std::map<std::string, ejson::Value*> m_value; //!< value of the node (for element this is the name, for text it is the inside text ...)
|
||||||
public:
|
public:
|
||||||
@ -56,7 +56,7 @@ namespace ejson {
|
|||||||
* @brief Get all the element name (keys).
|
* @brief Get all the element name (keys).
|
||||||
* @return a vector of all name (key).
|
* @return a vector of all name (key).
|
||||||
*/
|
*/
|
||||||
std::vector<std::string> getKeys(void) const {
|
std::vector<std::string> getKeys() const {
|
||||||
std::vector<std::string> keys;
|
std::vector<std::string> keys;
|
||||||
for (auto &it : m_value) {
|
for (auto &it : m_value) {
|
||||||
keys.push_back(it.first);
|
keys.push_back(it.first);
|
||||||
@ -67,7 +67,7 @@ namespace ejson {
|
|||||||
* @brief get the number of sub element in the current one
|
* @brief get the number of sub element in the current one
|
||||||
* @return the Number of stored element
|
* @return the Number of stored element
|
||||||
*/
|
*/
|
||||||
size_t size(void) const {
|
size_t size() const {
|
||||||
return m_value.size();
|
return m_value.size();
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@ -231,9 +231,9 @@ namespace ejson {
|
|||||||
public: // herited function :
|
public: // herited function :
|
||||||
virtual bool iParse(const std::string& _data, size_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc);
|
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 iGenerate(std::string& _data, size_t _indent) const;
|
||||||
virtual void clear(void);
|
virtual void clear();
|
||||||
virtual bool transfertIn(ejson::Value* _obj);
|
virtual bool transfertIn(ejson::Value* _obj);
|
||||||
virtual ejson::Value* duplicate(void) const;
|
virtual ejson::Value* duplicate() const;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ bool ejson::String::transfertIn(ejson::Value* _obj) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ejson::Value* ejson::String::duplicate(void) const {
|
ejson::Value* ejson::String::duplicate() const {
|
||||||
ejson::String* output = new ejson::String(m_value);
|
ejson::String* output = new ejson::String(m_value);
|
||||||
if (NULL == output) {
|
if (NULL == output) {
|
||||||
JSON_ERROR("Allocation error ...");
|
JSON_ERROR("Allocation error ...");
|
||||||
|
@ -25,7 +25,7 @@ namespace ejson {
|
|||||||
/**
|
/**
|
||||||
* @brief destructor
|
* @brief destructor
|
||||||
*/
|
*/
|
||||||
virtual ~String(void) { };
|
virtual ~String() { };
|
||||||
protected:
|
protected:
|
||||||
std::string m_value; //!< value of the node (for element this is the name, for text it is the inside text ...)
|
std::string m_value; //!< value of the node (for element this is the name, for text it is the inside text ...)
|
||||||
public:
|
public:
|
||||||
@ -40,14 +40,14 @@ namespace ejson {
|
|||||||
* @brief get the current element Value.
|
* @brief get the current element Value.
|
||||||
* @return the reference of the string value.
|
* @return the reference of the string value.
|
||||||
*/
|
*/
|
||||||
const std::string& get(void) const {
|
const std::string& get() const {
|
||||||
return m_value;
|
return m_value;
|
||||||
};
|
};
|
||||||
public: // herited function :
|
public: // herited function :
|
||||||
virtual bool iParse(const std::string& _data, size_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc);
|
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 iGenerate(std::string& _data, size_t _indent) const;
|
||||||
virtual bool transfertIn(ejson::Value* _obj);
|
virtual bool transfertIn(ejson::Value* _obj);
|
||||||
virtual ejson::Value* duplicate(void) const;
|
virtual ejson::Value* duplicate() const;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ejson::Value::~Value(void) {
|
ejson::Value::~Value() {
|
||||||
clear();
|
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<ejson::Document*>(this);
|
return dynamic_cast<ejson::Document*>(this);
|
||||||
};
|
};
|
||||||
const ejson::Document* ejson::Value::toDocument(void) const {
|
const ejson::Document* ejson::Value::toDocument() const {
|
||||||
return dynamic_cast<const ejson::Document*>(this);
|
return dynamic_cast<const ejson::Document*>(this);
|
||||||
};
|
};
|
||||||
ejson::Array* ejson::Value::toArray(void) {
|
ejson::Array* ejson::Value::toArray() {
|
||||||
return dynamic_cast<ejson::Array*>(this);
|
return dynamic_cast<ejson::Array*>(this);
|
||||||
};
|
};
|
||||||
const ejson::Array* ejson::Value::toArray(void) const{
|
const ejson::Array* ejson::Value::toArray() const{
|
||||||
return dynamic_cast<const ejson::Array*>(this);
|
return dynamic_cast<const ejson::Array*>(this);
|
||||||
};
|
};
|
||||||
ejson::Object* ejson::Value::toObject(void) {
|
ejson::Object* ejson::Value::toObject() {
|
||||||
return dynamic_cast<ejson::Object*>(this);
|
return dynamic_cast<ejson::Object*>(this);
|
||||||
};
|
};
|
||||||
const ejson::Object* ejson::Value::toObject(void) const{
|
const ejson::Object* ejson::Value::toObject() const{
|
||||||
return dynamic_cast<const ejson::Object*>(this);
|
return dynamic_cast<const ejson::Object*>(this);
|
||||||
};
|
};
|
||||||
ejson::String* ejson::Value::toString(void) {
|
ejson::String* ejson::Value::toString() {
|
||||||
return dynamic_cast<ejson::String*>(this);
|
return dynamic_cast<ejson::String*>(this);
|
||||||
};
|
};
|
||||||
const ejson::String* ejson::Value::toString(void) const{
|
const ejson::String* ejson::Value::toString() const{
|
||||||
return dynamic_cast<const ejson::String*>(this);
|
return dynamic_cast<const ejson::String*>(this);
|
||||||
};
|
};
|
||||||
ejson::Number* ejson::Value::toNumber(void) {
|
ejson::Number* ejson::Value::toNumber() {
|
||||||
return dynamic_cast<ejson::Number*>(this);
|
return dynamic_cast<ejson::Number*>(this);
|
||||||
};
|
};
|
||||||
const ejson::Number* ejson::Value::toNumber(void) const{
|
const ejson::Number* ejson::Value::toNumber() const{
|
||||||
return dynamic_cast<const ejson::Number*>(this);
|
return dynamic_cast<const ejson::Number*>(this);
|
||||||
};
|
};
|
||||||
ejson::Boolean* ejson::Value::toBoolean(void) {
|
ejson::Boolean* ejson::Value::toBoolean() {
|
||||||
return dynamic_cast<ejson::Boolean*>(this);
|
return dynamic_cast<ejson::Boolean*>(this);
|
||||||
};
|
};
|
||||||
const ejson::Boolean* ejson::Value::toBoolean(void) const{
|
const ejson::Boolean* ejson::Value::toBoolean() const{
|
||||||
return dynamic_cast<const ejson::Boolean*>(this);
|
return dynamic_cast<const ejson::Boolean*>(this);
|
||||||
};
|
};
|
||||||
ejson::Null* ejson::Value::toNull(void) {
|
ejson::Null* ejson::Value::toNull() {
|
||||||
return dynamic_cast<ejson::Null*>(this);
|
return dynamic_cast<ejson::Null*>(this);
|
||||||
};
|
};
|
||||||
const ejson::Null* ejson::Value::toNull(void) const{
|
const ejson::Null* ejson::Value::toNull() const{
|
||||||
return dynamic_cast<const ejson::Null*>(this);
|
return dynamic_cast<const ejson::Null*>(this);
|
||||||
};
|
};
|
@ -36,7 +36,7 @@ namespace ejson {
|
|||||||
size_t m_col;
|
size_t m_col;
|
||||||
size_t m_line;
|
size_t m_line;
|
||||||
public:
|
public:
|
||||||
filePos(void) :
|
filePos() :
|
||||||
m_col(0),
|
m_col(0),
|
||||||
m_line(0) {
|
m_line(0) {
|
||||||
|
|
||||||
@ -46,12 +46,12 @@ namespace ejson {
|
|||||||
m_line(_line) {
|
m_line(_line) {
|
||||||
|
|
||||||
};
|
};
|
||||||
~filePos(void) { };
|
~filePos() { };
|
||||||
filePos& operator ++(void) {
|
filePos& operator ++() {
|
||||||
m_col++;
|
m_col++;
|
||||||
return *this;
|
return *this;
|
||||||
};
|
};
|
||||||
filePos& operator --(void) {
|
filePos& operator --() {
|
||||||
if(m_col>0) {
|
if(m_col>0) {
|
||||||
m_col--;
|
m_col--;
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ namespace ejson {
|
|||||||
m_line = _obj.m_line;
|
m_line = _obj.m_line;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
void newLine(void) {
|
void newLine() {
|
||||||
m_col=0;
|
m_col=0;
|
||||||
m_line++;
|
m_line++;
|
||||||
};
|
};
|
||||||
@ -91,14 +91,14 @@ namespace ejson {
|
|||||||
m_col = _col;
|
m_col = _col;
|
||||||
m_line = _line;
|
m_line = _line;
|
||||||
}
|
}
|
||||||
void clear(void) {
|
void clear() {
|
||||||
m_col = 0;
|
m_col = 0;
|
||||||
m_line = 0;
|
m_line = 0;
|
||||||
}
|
}
|
||||||
int32_t getCol(void) const {
|
int32_t getCol() const {
|
||||||
return m_col;
|
return m_col;
|
||||||
};
|
};
|
||||||
int32_t getLine(void) const {
|
int32_t getLine() const {
|
||||||
return m_line;
|
return m_line;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -109,11 +109,11 @@ namespace ejson {
|
|||||||
/**
|
/**
|
||||||
* @brief basic element of a xml structure
|
* @brief basic element of a xml structure
|
||||||
*/
|
*/
|
||||||
Value(void) { };
|
Value() { };
|
||||||
/**
|
/**
|
||||||
* @brief destructor
|
* @brief destructor
|
||||||
*/
|
*/
|
||||||
virtual ~Value(void);
|
virtual ~Value();
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief parse the Current node [pure VIRUAL]
|
* @brief parse the Current node [pure VIRUAL]
|
||||||
@ -167,117 +167,117 @@ namespace ejson {
|
|||||||
* @brief Cast the element in a Value if it is possible.
|
* @brief Cast the element in a Value if it is possible.
|
||||||
* @return pointer on the class or NULL.
|
* @return pointer on the class or NULL.
|
||||||
*/
|
*/
|
||||||
ejson::Value* toValue(void) {
|
ejson::Value* toValue() {
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
//! @previous
|
//! @previous
|
||||||
const ejson::Value* toValue(void) const {
|
const ejson::Value* toValue() const {
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief Cast the element in a Document if it is possible.
|
* @brief Cast the element in a Document if it is possible.
|
||||||
* @return pointer on the class or NULL.
|
* @return pointer on the class or NULL.
|
||||||
*/
|
*/
|
||||||
ejson::Document* toDocument(void);
|
ejson::Document* toDocument();
|
||||||
//! @previous
|
//! @previous
|
||||||
const ejson::Document* toDocument(void) const;
|
const ejson::Document* toDocument() const;
|
||||||
/**
|
/**
|
||||||
* @brief Cast the element in a Array if it is possible.
|
* @brief Cast the element in a Array if it is possible.
|
||||||
* @return pointer on the class or NULL.
|
* @return pointer on the class or NULL.
|
||||||
*/
|
*/
|
||||||
ejson::Array* toArray(void);
|
ejson::Array* toArray();
|
||||||
//! @previous
|
//! @previous
|
||||||
const ejson::Array* toArray(void) const;
|
const ejson::Array* toArray() const;
|
||||||
/**
|
/**
|
||||||
* @brief Cast the element in a Object if it is possible.
|
* @brief Cast the element in a Object if it is possible.
|
||||||
* @return pointer on the class or NULL.
|
* @return pointer on the class or NULL.
|
||||||
*/
|
*/
|
||||||
ejson::Object* toObject(void);
|
ejson::Object* toObject();
|
||||||
//! @previous
|
//! @previous
|
||||||
const ejson::Object* toObject(void) const;
|
const ejson::Object* toObject() const;
|
||||||
/**
|
/**
|
||||||
* @brief Cast the element in a String if it is possible.
|
* @brief Cast the element in a String if it is possible.
|
||||||
* @return pointer on the class or NULL.
|
* @return pointer on the class or NULL.
|
||||||
*/
|
*/
|
||||||
ejson::String* toString(void);
|
ejson::String* toString();
|
||||||
//! @previous
|
//! @previous
|
||||||
const ejson::String* toString(void) const;
|
const ejson::String* toString() const;
|
||||||
/**
|
/**
|
||||||
* @brief Cast the element in a Number if it is possible.
|
* @brief Cast the element in a Number if it is possible.
|
||||||
* @return pointer on the class or NULL.
|
* @return pointer on the class or NULL.
|
||||||
*/
|
*/
|
||||||
ejson::Number* toNumber(void);
|
ejson::Number* toNumber();
|
||||||
//! @previous
|
//! @previous
|
||||||
const ejson::Number* toNumber(void) const;
|
const ejson::Number* toNumber() const;
|
||||||
/**
|
/**
|
||||||
* @brief Cast the element in a Boolean if it is possible.
|
* @brief Cast the element in a Boolean if it is possible.
|
||||||
* @return pointer on the class or NULL.
|
* @return pointer on the class or NULL.
|
||||||
*/
|
*/
|
||||||
ejson::Boolean* toBoolean(void);
|
ejson::Boolean* toBoolean();
|
||||||
//! @previous
|
//! @previous
|
||||||
const ejson::Boolean* toBoolean(void) const;
|
const ejson::Boolean* toBoolean() const;
|
||||||
/**
|
/**
|
||||||
* @brief Cast the element in a Null if it is possible.
|
* @brief Cast the element in a Null if it is possible.
|
||||||
* @return pointer on the class or NULL.
|
* @return pointer on the class or NULL.
|
||||||
*/
|
*/
|
||||||
ejson::Null* toNull(void);
|
ejson::Null* toNull();
|
||||||
//! @previous
|
//! @previous
|
||||||
const ejson::Null* toNull(void) const;
|
const ejson::Null* toNull() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief check if the node is a ejson::Document
|
* @brief check if the node is a ejson::Document
|
||||||
* @return true 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;
|
return toDocument() != NULL;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief check if the node is a ejson::Array
|
* @brief check if the node is a ejson::Array
|
||||||
* @return true 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;
|
return toArray() != NULL;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief check if the node is a ejson::Object
|
* @brief check if the node is a ejson::Object
|
||||||
* @return true 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;
|
return toObject() != NULL;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief check if the node is a ejson::String
|
* @brief check if the node is a ejson::String
|
||||||
* @return true 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;
|
return toString() != NULL;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief check if the node is a ejson::Number
|
* @brief check if the node is a ejson::Number
|
||||||
* @return true 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;
|
return toNumber() != NULL;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief check if the node is a ejson::Boolean
|
* @brief check if the node is a ejson::Boolean
|
||||||
* @return true 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;
|
return toBoolean() != NULL;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @brief check if the node is a ejson::Null
|
* @brief check if the node is a ejson::Null
|
||||||
* @return true 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;
|
return toNull() != NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief clear the Node
|
* @brief clear the Node
|
||||||
*/
|
*/
|
||||||
virtual void clear(void) {};
|
virtual void clear() {};
|
||||||
/**
|
/**
|
||||||
* @brief Tranfert all element in the element set in parameter
|
* @brief Tranfert all element in the element set in parameter
|
||||||
* @param[in,out] _obj move all parameter in the selected element
|
* @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.
|
* @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
|
* @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;
|
return NULL;
|
||||||
};
|
};
|
||||||
protected:
|
protected:
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include <ejson/debug.h>
|
#include <ejson/debug.h>
|
||||||
|
|
||||||
int32_t ejson::getLogId(void) {
|
int32_t ejson::getLogId() {
|
||||||
static int32_t g_val = etk::log::registerInstance("ejson");
|
static int32_t g_val = etk::log::registerInstance("ejson");
|
||||||
return g_val;
|
return g_val;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include <etk/log.h>
|
#include <etk/log.h>
|
||||||
|
|
||||||
namespace ejson {
|
namespace ejson {
|
||||||
int32_t getLogId(void);
|
int32_t getLogId();
|
||||||
};
|
};
|
||||||
// TODO : Review this problem of multiple intanciation of "std::stringbuf sb"
|
// TODO : Review this problem of multiple intanciation of "std::stringbuf sb"
|
||||||
#define JSON_BASE(info,data) \
|
#define JSON_BASE(info,data) \
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "Document"
|
#define __class__ "Document"
|
||||||
|
|
||||||
ejson::Document::Document(void) :
|
ejson::Document::Document() :
|
||||||
m_writeErrorWhenDetexted(true),
|
m_writeErrorWhenDetexted(true),
|
||||||
m_comment(""),
|
m_comment(""),
|
||||||
m_Line(""),
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ejson::Document::display(void) {
|
void ejson::Document::display() {
|
||||||
std::string tmpp;
|
std::string tmpp;
|
||||||
iGenerate(tmpp, 0);
|
iGenerate(tmpp, 0);
|
||||||
JSON_INFO("Generated JSON : \n" << tmpp);
|
JSON_INFO("Generated JSON : \n" << tmpp);
|
||||||
@ -134,7 +134,7 @@ static std::string createPosPointer(const std::string& _line, size_t _pos) {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ejson::Document::displayError(void) {
|
void ejson::Document::displayError() {
|
||||||
if (m_comment.size() == 0) {
|
if (m_comment.size() == 0) {
|
||||||
JSON_ERROR("No error detected ???");
|
JSON_ERROR("No error detected ???");
|
||||||
return;
|
return;
|
||||||
|
@ -22,11 +22,11 @@ namespace ejson {
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
Document(void);
|
Document();
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
virtual ~Document(void);
|
virtual ~Document();
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief parse a string that contain an XML
|
* @brief parse a string that contain an XML
|
||||||
@ -59,22 +59,22 @@ namespace ejson {
|
|||||||
/**
|
/**
|
||||||
* @brief Display the Document on console
|
* @brief Display the Document on console
|
||||||
*/
|
*/
|
||||||
void display(void);
|
void display();
|
||||||
private:
|
private:
|
||||||
bool m_writeErrorWhenDetexted;
|
bool m_writeErrorWhenDetexted;
|
||||||
std::string m_comment;
|
std::string m_comment;
|
||||||
std::string m_Line;
|
std::string m_Line;
|
||||||
ejson::filePos m_filePos;
|
ejson::filePos m_filePos;
|
||||||
public:
|
public:
|
||||||
void displayErrorWhenDetected(void) {
|
void displayErrorWhenDetected() {
|
||||||
m_writeErrorWhenDetexted=true;
|
m_writeErrorWhenDetexted=true;
|
||||||
};
|
};
|
||||||
void notDisplayErrorWhenDetected(void) {
|
void notDisplayErrorWhenDetected() {
|
||||||
m_writeErrorWhenDetexted=false;
|
m_writeErrorWhenDetexted=false;
|
||||||
};
|
};
|
||||||
|
|
||||||
void createError(const std::string& _data, size_t _pos, const ejson::filePos& _filePos, const std::string& _comment);
|
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:
|
public: // herited function:
|
||||||
virtual bool iParse(const std::string& _data, size_t& _pos, ejson::filePos& _filePos, ejson::Document& _doc);
|
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 iGenerate(std::string& _data, size_t _indent) const;
|
||||||
|
@ -19,7 +19,7 @@ class testCheck {
|
|||||||
std::string m_ref;
|
std::string m_ref;
|
||||||
std::string m_input;
|
std::string m_input;
|
||||||
int32_t m_errorPos; // -1 : no error , 1 : parsing error, 2 generation error, 3 comparaison error ????
|
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) {
|
void set(const std::string& _ref, int32_t _pos, const std::string& _input) {
|
||||||
m_ref = _ref;
|
m_ref = _ref;
|
||||||
m_input = _input;
|
m_input = _input;
|
||||||
@ -29,7 +29,7 @@ class testCheck {
|
|||||||
|
|
||||||
std::vector<testCheck> l_list;
|
std::vector<testCheck> l_list;
|
||||||
|
|
||||||
void init(void) {
|
void init() {
|
||||||
std::string reference;
|
std::string reference;
|
||||||
std::string input;
|
std::string input;
|
||||||
testCheck check;
|
testCheck check;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user