diff --git a/JsonGenerator/JsonArrayBase.h b/JsonGenerator/JsonArrayBase.h index 1f1537b9..40710ecb 100644 --- a/JsonGenerator/JsonArrayBase.h +++ b/JsonGenerator/JsonArrayBase.h @@ -25,7 +25,7 @@ namespace ArduinoJson { if (count >= capacity) return; - items[count++].set(value); + items[count++] = value; } template diff --git a/JsonGenerator/JsonObjectBase.h b/JsonGenerator/JsonObjectBase.h index de6d6c86..f3e95060 100644 --- a/JsonGenerator/JsonObjectBase.h +++ b/JsonGenerator/JsonObjectBase.h @@ -19,7 +19,7 @@ namespace ArduinoJson template void add(const char* key, T value) { - getValue(key).set(value); + getValue(key) = value; } template diff --git a/JsonGenerator/JsonValue.h b/JsonGenerator/JsonValue.h index 3f24774a..85b7cfc0 100644 --- a/JsonGenerator/JsonValue.h +++ b/JsonGenerator/JsonValue.h @@ -17,37 +17,37 @@ namespace ArduinoJson { public: - void set(bool value) + void operator=(bool value) { printToImpl = &printBoolTo; content.asBool = value; } - void set(long value) + void operator=(long value) { printToImpl = &printLongTo; content.asLong = value; } - void set(int value) + void operator=(int value) { printToImpl = &printLongTo; content.asLong = value; } - void set(Printable& value) + void operator=(Printable& value) { printToImpl = &printPrintableTo; content.asPrintable = &value; } - void set(const char* value) + void operator=(const char* value) { printToImpl = &printStringTo; content.asString.set(value); } - void set(double value) + void operator=(double value) { set<2>(value); } @@ -55,7 +55,7 @@ namespace ArduinoJson template void set(double value) { - printToImpl = &printDoubleTo; + printToImpl = &printDoubleTo < DIGITS > ; content.asDouble = value; } @@ -82,7 +82,7 @@ namespace ArduinoJson Content content; - size_t(* printToImpl)(const Content&, Print&); + size_t(*printToImpl)(const Content&, Print&); static size_t printBoolTo(const Content&, Print&); static size_t printLongTo(const Content&, Print&); diff --git a/JsonGeneratorTests/JsonValueTests.cpp b/JsonGeneratorTests/JsonValueTests.cpp index 1ea1866e..c0cfab0a 100644 --- a/JsonGeneratorTests/JsonValueTests.cpp +++ b/JsonGeneratorTests/JsonValueTests.cpp @@ -89,7 +89,7 @@ namespace JsonGeneratorTests { StringBuilder sb(buffer, sizeof(buffer)); JsonValue jsonValue; - jsonValue.set(value); + jsonValue = value; returnValue = jsonValue.printTo(sb); }