2014-06-25 13:02:39 +02:00
|
|
|
/*
|
|
|
|
* Arduino JSON library
|
|
|
|
* Benoit Blanchon 2014 - MIT License
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2014-07-01 13:36:22 +02:00
|
|
|
#include "Print.h"
|
2014-06-30 19:19:39 +02:00
|
|
|
|
2014-07-01 13:36:22 +02:00
|
|
|
class StringBuilder : public Print
|
2014-06-25 13:02:39 +02:00
|
|
|
{
|
|
|
|
public:
|
2014-06-30 19:19:39 +02:00
|
|
|
StringBuilder(char* buf, int size)
|
2014-06-26 13:00:14 +02:00
|
|
|
: 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-07-01 14:08:15 +02:00
|
|
|
virtual size_t write(uint8_t c);
|
2014-06-25 13:02:39 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
char* buffer;
|
2014-06-30 19:19:39 +02:00
|
|
|
int capacity;
|
|
|
|
int length;
|
2014-06-25 13:02:39 +02:00
|
|
|
};
|
|
|
|
|