mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-01 16:14:05 +01:00
This commit is contained in:
29
include/ArduinoJson/Internals/DynamicStringBuilder.hpp
Normal file
29
include/ArduinoJson/Internals/DynamicStringBuilder.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright Benoit Blanchon 2014-2015
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../Arduino/Print.hpp"
|
||||
#include "../Arduino/String.hpp"
|
||||
|
||||
namespace ArduinoJson {
|
||||
namespace Internals {
|
||||
|
||||
// A Print implementation that allows to write in a String
|
||||
class DynamicStringBuilder : public Print {
|
||||
public:
|
||||
DynamicStringBuilder(String &str) : _str(str) {}
|
||||
|
||||
virtual size_t write(uint8_t c) {
|
||||
_str += c;
|
||||
return 1;
|
||||
}
|
||||
|
||||
private:
|
||||
String &_str;
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user