Templatized all functions using String or std::string

* Removed `ArduinoJson::String`
* Removed `JsonVariant::defaultValue<T>()`
* Removed non-template `JsonObject::get()` and `JsonArray.get()`
* Fixed support for `StringSumHelper` (issue #184)
* Replaced `ARDUINOJSON_USE_ARDUINO_STRING` by `ARDUINOJSON_ENABLE_STD_STRING` and `ARDUINOJSON_ENABLE_ARDUINO_STRING` (issue #378)
* Added example `StringExample.ino` to show where `String` can be used
This commit is contained in:
Benoit Blanchon
2016-11-06 17:48:32 +01:00
parent 7ad57f1c33
commit aa2ef79e55
31 changed files with 622 additions and 545 deletions

View File

@ -5,8 +5,8 @@
// https://github.com/bblanchon/ArduinoJson
// If you like this project, please add a star!
#include <gtest/gtest.h>
#include <ArduinoJson.h>
#include <gtest/gtest.h>
class JsonObject_Set_Tests : public ::testing::Test {
public:
@ -112,7 +112,7 @@ TEST_(ShouldReturnTrue_WhenAllocationSucceeds) {
StaticJsonBuffer<JSON_OBJECT_SIZE(1) + 15> jsonBuffer;
JsonObject& obj = jsonBuffer.createObject();
bool result = obj.set(String("hello"), String("world"));
bool result = obj.set(std::string("hello"), std::string("world"));
ASSERT_TRUE(result);
}
@ -121,7 +121,7 @@ TEST_(ShouldReturnFalse_WhenAllocationFails) {
StaticJsonBuffer<JSON_OBJECT_SIZE(1) + 10> jsonBuffer;
JsonObject& obj = jsonBuffer.createObject();
bool result = obj.set(String("hello"), String("world"));
bool result = obj.set(std::string("hello"), std::string("world"));
ASSERT_FALSE(result);
}