Huge refactoring in progress...

This commit is contained in:
Benoit Blanchon
2014-10-30 15:31:27 +01:00
parent 4c204840e9
commit 45a8ed6531
7 changed files with 12 additions and 5 deletions

View File

@ -18,6 +18,9 @@ class JsonObjectNode {
JsonPair pair; JsonPair pair;
JsonObjectNode* next; JsonObjectNode* next;
// warning C4512: assignment operator could not be generated
#pragma warning( suppress : 4512 )
}; };
} }
} }

View File

@ -68,7 +68,7 @@ class JsonArray : public JsonPrintable {
static JsonArray _invalid; static JsonArray _invalid;
}; };
bool operator==(const JsonArray &left, const JsonArray &right) { inline bool operator==(const JsonArray &left, const JsonArray &right) {
// two JsonArray are equal if they are the same instance // two JsonArray are equal if they are the same instance
// (we don't compare the content) // (we don't compare the content)
return &left == &right; return &left == &right;

View File

@ -72,7 +72,7 @@ class JsonObject : public JsonPrintable {
static JsonObject _invalid; static JsonObject _invalid;
}; };
bool operator==(const JsonObject &left, const JsonObject &right) { inline bool operator==(const JsonObject &left, const JsonObject &right) {
// two JsonObject are equal if they are the same instance // two JsonObject are equal if they are the same instance
// (we don't compare the content) // (we don't compare the content)
return &left == &right; return &left == &right;

View File

@ -16,5 +16,8 @@ struct JsonPair {
const char* const key; const char* const key;
JsonValue value; JsonValue value;
// warning C4512: assignment operator could not be generated
#pragma warning( suppress : 4512 )
}; };
} }

View File

@ -45,6 +45,7 @@ class JsonValue {
operator const char *() const; operator const char *() const;
operator double() const; operator double() const;
operator long() const; operator long() const;
operator int() const { return operator long(); }
operator JsonArray &() const; operator JsonArray &() const;
operator JsonObject &() const; operator JsonObject &() const;

View File

@ -39,7 +39,7 @@ JsonValue &JsonArray::add() {
} }
JsonArrayNode *JsonArray::createNode() { JsonArrayNode *JsonArray::createNode() {
if (_buffer) return NULL; if (!_buffer) return NULL;
void *ptr = _buffer->alloc(sizeof(JsonArrayNode)); void *ptr = _buffer->alloc(sizeof(JsonArrayNode));
return ptr ? new (ptr) JsonArrayNode() : NULL; return ptr ? new (ptr) JsonArrayNode() : NULL;
} }

View File

@ -18,7 +18,7 @@ class JsonObject_Container_Tests : public ::testing::Test {
JsonObject_Container_Tests() : object(json.createObject()) {} JsonObject_Container_Tests() : object(json.createObject()) {}
protected: protected:
StaticJsonBuffer<42> json; StaticJsonBuffer<256> json;
JsonObject& object; JsonObject& object;
}; };