forked from bblanchon/ArduinoJson
Extracted class IndentedPrintDecorator from PrettyPrintDecorator
This commit is contained in:
36
JsonGenerator/IndentedPrintDecorator.h
Normal file
36
JsonGenerator/IndentedPrintDecorator.h
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Arduino JSON library
|
||||
* Benoit Blanchon 2014 - MIT License
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Print.h"
|
||||
|
||||
class IndentedPrintDecorator : public Print
|
||||
{
|
||||
public:
|
||||
|
||||
IndentedPrintDecorator(Print& p)
|
||||
: sink(p)
|
||||
{
|
||||
pendingTabCount = 0;
|
||||
currentTabCount = 0;
|
||||
isNewLine = true;
|
||||
}
|
||||
|
||||
void indent();
|
||||
void unindent();
|
||||
|
||||
bool isNewLine;
|
||||
virtual size_t write(uint8_t);
|
||||
|
||||
private:
|
||||
Print& sink;
|
||||
int currentTabCount;
|
||||
int pendingTabCount;
|
||||
|
||||
size_t writeCurrentTabs();
|
||||
size_t writeTabs(int count);
|
||||
};
|
||||
|
Reference in New Issue
Block a user