mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-16 12:02:14 +02:00
38 lines
822 B
C++
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;
|
|
};
|
|
}
|
|
} |