Renamed IndentedPrintDecorator into IndentedPrint

This commit is contained in:
Benoit Blanchon
2014-08-26 09:56:05 +02:00
parent b5002265cf
commit 23e61cc0f7
9 changed files with 19 additions and 19 deletions

View File

@ -1,18 +1,18 @@
#include "IndentedPrintDecorator.h" #include "IndentedPrint.h"
void IndentedPrintDecorator::indent() void IndentedPrint::indent()
{ {
if (level<127) if (level<127)
level++; level++;
} }
void IndentedPrintDecorator::unindent() void IndentedPrint::unindent()
{ {
if (level>0) if (level>0)
level--; level--;
} }
size_t IndentedPrintDecorator::write(uint8_t c) size_t IndentedPrint::write(uint8_t c)
{ {
size_t n = 0; size_t n = 0;
@ -26,7 +26,7 @@ size_t IndentedPrintDecorator::write(uint8_t c)
return n; return n;
} }
size_t IndentedPrintDecorator::writeTabs() size_t IndentedPrint::writeTabs()
{ {
size_t n = 0; size_t n = 0;

View File

@ -7,11 +7,11 @@
#include "Print.h" #include "Print.h"
class IndentedPrintDecorator : public Print class IndentedPrint : public Print
{ {
public: public:
IndentedPrintDecorator(Print& p) IndentedPrint(Print& p)
: sink(p) : sink(p)
{ {
level = 0; level = 0;

View File

@ -12,7 +12,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="EscapedString.h" /> <ClInclude Include="EscapedString.h" />
<ClInclude Include="IndentedPrintDecorator.h" /> <ClInclude Include="IndentedPrint.h" />
<ClInclude Include="PrettyPrintDecorator.h" /> <ClInclude Include="PrettyPrintDecorator.h" />
<ClInclude Include="JsonArray.h" /> <ClInclude Include="JsonArray.h" />
<ClInclude Include="JsonArrayBase.h" /> <ClInclude Include="JsonArrayBase.h" />
@ -26,7 +26,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="EscapedString.cpp" /> <ClCompile Include="EscapedString.cpp" />
<ClCompile Include="IndentedPrintDecorator.cpp" /> <ClCompile Include="IndentedPrint.cpp" />
<ClCompile Include="PrettyPrintDecorator.cpp" /> <ClCompile Include="PrettyPrintDecorator.cpp" />
<ClCompile Include="JsonArrayBase.cpp" /> <ClCompile Include="JsonArrayBase.cpp" />
<ClCompile Include="JsonObjectBase.cpp" /> <ClCompile Include="JsonObjectBase.cpp" />

View File

@ -48,7 +48,7 @@
<ClInclude Include="PrettyPrintDecorator.h"> <ClInclude Include="PrettyPrintDecorator.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="IndentedPrintDecorator.h"> <ClInclude Include="IndentedPrint.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>
@ -74,7 +74,7 @@
<ClCompile Include="PrettyPrintDecorator.cpp"> <ClCompile Include="PrettyPrintDecorator.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="IndentedPrintDecorator.cpp"> <ClCompile Include="IndentedPrint.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>

View File

@ -26,7 +26,7 @@ namespace ArduinoJson
return printTo(sb); return printTo(sb);
} }
size_t prettyPrintTo(IndentedPrintDecorator& p) const size_t prettyPrintTo(IndentedPrint& p) const
{ {
PrettyPrintDecorator decorator(p); PrettyPrintDecorator decorator(p);
return printTo(decorator); return printTo(decorator);
@ -34,7 +34,7 @@ namespace ArduinoJson
size_t prettyPrintTo(Print& p) const size_t prettyPrintTo(Print& p) const
{ {
IndentedPrintDecorator decorator(p); IndentedPrint decorator(p);
return printTo(decorator); return printTo(decorator);
} }

View File

@ -6,7 +6,7 @@
#pragma once #pragma once
#include "Print.h" #include "Print.h"
#include "IndentedPrintDecorator.h" #include "IndentedPrint.h"
namespace ArduinoJson namespace ArduinoJson
{ {
@ -16,7 +16,7 @@ namespace ArduinoJson
{ {
public: public:
PrettyPrintDecorator(IndentedPrintDecorator& p) PrettyPrintDecorator(IndentedPrint& p)
: sink(p) : sink(p)
{ {
previousChar = 0; previousChar = 0;
@ -27,7 +27,7 @@ namespace ArduinoJson
private: private:
uint8_t previousChar; uint8_t previousChar;
IndentedPrintDecorator& sink; IndentedPrint& sink;
bool inString; bool inString;
bool inEmptyBlock() bool inEmptyBlock()

View File

@ -76,7 +76,7 @@ namespace JsonGeneratorTests
void whenInputIs(const char input[]) void whenInputIs(const char input[])
{ {
StringBuilder sb(buffer, sizeof(buffer)); StringBuilder sb(buffer, sizeof(buffer));
IndentedPrintDecorator indentedPrint(sb); IndentedPrint indentedPrint(sb);
PrettyPrintDecorator decorator(indentedPrint); PrettyPrintDecorator decorator(indentedPrint);
returnValue = decorator.print(input); returnValue = decorator.print(input);

View File

@ -74,7 +74,7 @@ namespace JsonGeneratorTests
void whenInputIs(const char input[]) void whenInputIs(const char input[])
{ {
StringBuilder sb(buffer, sizeof(buffer)); StringBuilder sb(buffer, sizeof(buffer));
IndentedPrintDecorator indentedPrint(sb); IndentedPrint indentedPrint(sb);
PrettyPrintDecorator decorator(indentedPrint); PrettyPrintDecorator decorator(indentedPrint);
returnValue = decorator.print(input); returnValue = decorator.print(input);

View File

@ -61,7 +61,7 @@ namespace JsonGeneratorTests
void whenInputIs(const char input[]) void whenInputIs(const char input[])
{ {
StringBuilder sb(buffer, sizeof(buffer)); StringBuilder sb(buffer, sizeof(buffer));
IndentedPrintDecorator indentedPrint(sb); IndentedPrint indentedPrint(sb);
PrettyPrintDecorator decorator(indentedPrint); PrettyPrintDecorator decorator(indentedPrint);
returnValue = decorator.print(input); returnValue = decorator.print(input);