mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-01 16:14:05 +01:00
31 lines
536 B
C++
31 lines
536 B
C++
// Copyright Benoit Blanchon 2014
|
|
// MIT License
|
|
//
|
|
// Arduino JSON library
|
|
// https://github.com/bblanchon/ArduinoJson
|
|
|
|
#pragma once
|
|
|
|
#include "../Arduino/Print.hpp"
|
|
|
|
namespace ArduinoJson {
|
|
namespace Internals {
|
|
|
|
// A Print implementation that allows to write in a char[]
|
|
class StringBuilder : public Print {
|
|
public:
|
|
StringBuilder(char *buf, int size)
|
|
: buffer(buf), capacity(size - 1), length(0) {
|
|
buffer[0] = '\0';
|
|
}
|
|
|
|
virtual size_t write(uint8_t c);
|
|
|
|
private:
|
|
char *buffer;
|
|
int capacity;
|
|
int length;
|
|
};
|
|
}
|
|
}
|