Tasmota/lib/ArduinoJson/include/ArduinoJson/Serialization/DynamicStringBuilder.hpp
arendst aaabe37f15 Add correct libraries
Arduino IDE: Place libraries in portable/sketchbook/libraries folder.
PlatformIO: Place libraries in your projects lib folder.
2017-02-21 09:50:32 +01:00

34 lines
715 B
C++

// Copyright Benoit Blanchon 2014-2017
// 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 "../StringTraits/StringTraits.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) {
StringTraits<TString>::append(_str, static_cast<char>(c));
return 1;
}
private:
DynamicStringBuilder &operator=(const DynamicStringBuilder &);
TString &_str;
};
}
}