Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions src/yajson/yajson.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class Value {
typedef std::unique_ptr<Instance> InstPtr;
static size_t skipWhitespace(const std::string& text, size_t offset);
private:
Value(InstPtr instance);
explicit Value(InstPtr instance);
InstPtr _instance;

static void _parseWord(const std::string& text, const std::string& word, size_t& offset);
Expand Down Expand Up @@ -134,8 +134,8 @@ class String : public Instance {
public:
static std::string parse(const std::string& text, size_t& offset);

String(const std::string& value);
virtual ~String()=default;
explicit String(const std::string& value);
virtual ~String() override {};

virtual Instance *clone() const override;
virtual void format(std::string &buffer, int indent, int indentLevel) const override;
Expand All @@ -157,8 +157,8 @@ class String : public Instance {

class Integer : public Instance {
public:
Integer(const int64_t value);
virtual ~Integer()=default;
explicit Integer(const int64_t value);
virtual ~Integer() override {};

virtual Instance *clone() const override;
virtual void format(std::string &buffer, int indent, int indentLevel) const override;
Expand All @@ -175,8 +175,8 @@ class Integer : public Instance {

class Real : public Instance {
public:
Real(const double value);
virtual ~Real()=default;
explicit Real(const double value);
virtual ~Real() override {};

virtual Instance *clone() const override;
virtual void format(std::string &buffer, int indent, int indentLevel) const override;
Expand All @@ -193,8 +193,8 @@ class Real : public Instance {

class Boolean : public Instance {
public:
Boolean(const bool value);
virtual ~Boolean()=default;
explicit Boolean(const bool value);
virtual ~Boolean() override {};

virtual Instance *clone() const override;
virtual void format(std::string &buffer, int indent, int indentLevel) const override;
Expand All @@ -213,8 +213,8 @@ class Array : public Instance {
public:
static Array* parse(const std::string& text, size_t& offset);

Array(const std::vector<Value>& value);
virtual ~Array()=default;
explicit Array(const std::vector<Value>& value);
virtual ~Array() override {};

virtual Instance *clone() const override;
virtual void format(std::string &buffer, int indent, int indentLevel) const override;
Expand All @@ -240,8 +240,8 @@ class Object : public Instance {
public:
static Object* parse(const std::string& text, size_t& offset);

Object(const std::map<std::string, Value>& value);
virtual ~Object()=default;
explicit Object(const std::map<std::string, Value>& value);
virtual ~Object() override {};

virtual Instance *clone() const override;
virtual void format(std::string &buffer, int indent, int indentLevel) const override;
Expand All @@ -265,6 +265,8 @@ class Object : public Instance {
};

#define YaJsonAssert(expression) if (!(expression)) {throw std::invalid_argument("Failed: " #expression);} else
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wempty-body"

inline Value Value::parse(const std::string& jsonText, size_t* position) {
Value value;
Expand Down Expand Up @@ -1319,5 +1321,6 @@ inline void Object::set(const std::string& key, const Value& value) {
_value[key] = value;
}

#pragma GCC diagnostic pop
#undef YaJsonAssert
}