Files
ArduinoJson/JsonGeneratorTests/StringBuilder.h

31 lines
524 B
C
Raw Normal View History

2014-06-25 13:02:39 +02:00
/*
* Arduino JSON library
* Benoit Blanchon 2014 - MIT License
*/
#pragma once
#include <cstdarg>
#include <cstdio>
#include <cstring>
class StringBuilder
{
public:
StringBuilder(char* buf, size_t size)
: buffer(buf), capacity(size-1), length(0)
2014-06-25 13:02:39 +02:00
{
2014-06-26 12:50:48 +02:00
buffer[0] = 0;
2014-06-25 13:02:39 +02:00
}
2014-06-25 13:50:28 +02:00
void append(const char* s);
void appendEscaped(const char* s);
2014-06-25 13:50:28 +02:00
void appendFormatted(const char* format, ...);
2014-06-25 13:02:39 +02:00
private:
char* buffer;
size_t capacity;
size_t length;
2014-06-25 13:02:39 +02:00
};