Files
ArduinoJson/JsonGenerator/JsonPrintable.h
2014-08-25 11:39:04 +02:00

38 lines
822 B
C++

/*
* Arduino JSON library
* Benoit Blanchon 2014 - MIT License
*/
#pragma once
#include "JsonValue.h"
#include "Print.h"
#include "Printable.h"
#include "IndentedPrintDecorator.h"
namespace ArduinoJson
{
namespace Generator
{
class JsonPrintable : public Printable
{
public:
size_t printTo(char* buffer, size_t bufferSize)
{
using namespace Internals;
StringBuilder sb(buffer, bufferSize);
return printTo(sb);
}
size_t prettyPrintTo(Print& p) const
{
IndentedPrintDecorator decorator(p);
return printTo(decorator);
}
virtual size_t printTo(Print& p) const = 0;
};
}
}