2014-08-25 09:06:21 +02:00
|
|
|
#pragma once
|
|
|
|
/*
|
|
|
|
* Arduino JSON library
|
|
|
|
* Benoit Blanchon 2014 - MIT License
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Print.h"
|
|
|
|
|
|
|
|
class IndentedPrintDecorator : public Print
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
IndentedPrintDecorator(Print& p)
|
2014-08-25 10:31:03 +02:00
|
|
|
: indent(0), sink(p)
|
2014-08-25 09:06:21 +02:00
|
|
|
{
|
2014-08-25 10:31:03 +02:00
|
|
|
previousChar = 0;
|
|
|
|
isInAString = false;
|
2014-08-25 09:06:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual size_t write(uint8_t);
|
|
|
|
|
|
|
|
private:
|
2014-08-25 09:52:42 +02:00
|
|
|
int indent;
|
2014-08-25 10:31:03 +02:00
|
|
|
uint8_t previousChar;
|
2014-08-25 09:17:32 +02:00
|
|
|
Print& sink;
|
2014-08-25 10:31:03 +02:00
|
|
|
bool isInAString;
|
2014-08-25 09:52:42 +02:00
|
|
|
|
|
|
|
size_t writeln();
|
2014-08-25 09:06:21 +02:00
|
|
|
};
|
|
|
|
|