diff --git a/JsonGenerator/IndentedPrintDecorator.cpp b/JsonGenerator/IndentedPrintDecorator.cpp new file mode 100644 index 00000000..51add965 --- /dev/null +++ b/JsonGenerator/IndentedPrintDecorator.cpp @@ -0,0 +1,11 @@ +/* +* Arduino JSON library +* Benoit Blanchon 2014 - MIT License +*/ + +#include "IndentedPrintDecorator.h" + +size_t IndentedPrintDecorator::write(uint8_t c) +{ + return print.write(c); +} \ No newline at end of file diff --git a/JsonGenerator/IndentedPrintDecorator.h b/JsonGenerator/IndentedPrintDecorator.h new file mode 100644 index 00000000..631ea255 --- /dev/null +++ b/JsonGenerator/IndentedPrintDecorator.h @@ -0,0 +1,26 @@ +#pragma once +/* +* Arduino JSON library +* Benoit Blanchon 2014 - MIT License +*/ + +#pragma once + +#include "Print.h" + +class IndentedPrintDecorator : public Print +{ +public: + + IndentedPrintDecorator(Print& p) + : currentLevel(0), print(p) + { + } + + virtual size_t write(uint8_t); + +private: + int currentLevel; + Print& print; +}; + diff --git a/JsonGenerator/JsonGenerator.vcxproj b/JsonGenerator/JsonGenerator.vcxproj index 34d5febc..e1f161af 100644 --- a/JsonGenerator/JsonGenerator.vcxproj +++ b/JsonGenerator/JsonGenerator.vcxproj @@ -12,6 +12,7 @@ + @@ -24,6 +25,7 @@ + diff --git a/JsonGenerator/JsonGenerator.vcxproj.filters b/JsonGenerator/JsonGenerator.vcxproj.filters index d8912d64..e6e350a9 100644 --- a/JsonGenerator/JsonGenerator.vcxproj.filters +++ b/JsonGenerator/JsonGenerator.vcxproj.filters @@ -45,6 +45,9 @@ Header Files + + Header Files + @@ -65,5 +68,8 @@ Source Files + + Source Files + \ No newline at end of file