mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-01 00:38:27 +01:00
* 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
34 lines
697 B
C++
34 lines
697 B
C++
// Copyright Benoit Blanchon 2014-2016
|
|
// MIT License
|
|
//
|
|
// Arduino JSON library
|
|
// https://github.com/bblanchon/ArduinoJson
|
|
// If you like this project, please add a star!
|
|
|
|
#pragma once
|
|
|
|
#include "../Print.hpp"
|
|
#include "StringFuncs.hpp"
|
|
|
|
namespace ArduinoJson {
|
|
namespace Internals {
|
|
|
|
// A Print implementation that allows to write in a String
|
|
template <typename TString>
|
|
class DynamicStringBuilder : public Print {
|
|
public:
|
|
DynamicStringBuilder(TString &str) : _str(str) {}
|
|
|
|
virtual size_t write(uint8_t c) {
|
|
StringFuncs<TString>::append(_str, static_cast<char>(c));
|
|
return 1;
|
|
}
|
|
|
|
private:
|
|
DynamicStringBuilder &operator=(const DynamicStringBuilder &);
|
|
|
|
TString &_str;
|
|
};
|
|
}
|
|
}
|