mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-16 12:02:14 +02:00
Renamed IndentedPrintDecorator to PrettyPrintDecorator
This commit is contained in:
@ -6,8 +6,8 @@
|
|||||||
// This file is here to help the Arduino IDE find the .cpp files
|
// This file is here to help the Arduino IDE find the .cpp files
|
||||||
|
|
||||||
#include "JsonGenerator/EscapedString.cpp"
|
#include "JsonGenerator/EscapedString.cpp"
|
||||||
#include "JsonGenerator/IndentedPrintDecorator.cpp"
|
|
||||||
#include "JsonGenerator/JsonArrayBase.cpp"
|
#include "JsonGenerator/JsonArrayBase.cpp"
|
||||||
#include "JsonGenerator/JsonObjectBase.cpp"
|
#include "JsonGenerator/JsonObjectBase.cpp"
|
||||||
#include "JsonGenerator/JsonValue.cpp"
|
#include "JsonGenerator/JsonValue.cpp"
|
||||||
|
#include "JsonGenerator/PrettyPrintDecorator.cpp"
|
||||||
#include "JsonGenerator/StringBuilder.cpp"
|
#include "JsonGenerator/StringBuilder.cpp"
|
@ -12,7 +12,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="EscapedString.h" />
|
<ClInclude Include="EscapedString.h" />
|
||||||
<ClInclude Include="IndentedPrintDecorator.h" />
|
<ClInclude Include="PrettyPrintDecorator.h" />
|
||||||
<ClInclude Include="JsonArray.h" />
|
<ClInclude Include="JsonArray.h" />
|
||||||
<ClInclude Include="JsonArrayBase.h" />
|
<ClInclude Include="JsonArrayBase.h" />
|
||||||
<ClInclude Include="JsonObject.h" />
|
<ClInclude Include="JsonObject.h" />
|
||||||
@ -25,7 +25,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="EscapedString.cpp" />
|
<ClCompile Include="EscapedString.cpp" />
|
||||||
<ClCompile Include="IndentedPrintDecorator.cpp" />
|
<ClCompile Include="PrettyPrintDecorator.cpp" />
|
||||||
<ClCompile Include="JsonArrayBase.cpp" />
|
<ClCompile Include="JsonArrayBase.cpp" />
|
||||||
<ClCompile Include="JsonObjectBase.cpp" />
|
<ClCompile Include="JsonObjectBase.cpp" />
|
||||||
<ClCompile Include="JsonValue.cpp" />
|
<ClCompile Include="JsonValue.cpp" />
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
<ClInclude Include="JsonObject.h">
|
<ClInclude Include="JsonObject.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="IndentedPrintDecorator.h">
|
<ClInclude Include="PrettyPrintDecorator.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@ -68,7 +68,7 @@
|
|||||||
<ClCompile Include="JsonObjectBase.cpp">
|
<ClCompile Include="JsonObjectBase.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="IndentedPrintDecorator.cpp">
|
<ClCompile Include="PrettyPrintDecorator.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "JsonValue.h"
|
#include "JsonValue.h"
|
||||||
#include "Print.h"
|
#include "Print.h"
|
||||||
#include "Printable.h"
|
#include "Printable.h"
|
||||||
#include "IndentedPrintDecorator.h"
|
#include "PrettyPrintDecorator.h"
|
||||||
|
|
||||||
namespace ArduinoJson
|
namespace ArduinoJson
|
||||||
{
|
{
|
||||||
@ -28,7 +28,7 @@ namespace ArduinoJson
|
|||||||
|
|
||||||
size_t prettyPrintTo(Print& p) const
|
size_t prettyPrintTo(Print& p) const
|
||||||
{
|
{
|
||||||
IndentedPrintDecorator decorator(p);
|
PrettyPrintDecorator decorator(p);
|
||||||
return printTo(decorator);
|
return printTo(decorator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
* Benoit Blanchon 2014 - MIT License
|
* Benoit Blanchon 2014 - MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "IndentedPrintDecorator.h"
|
#include "PrettyPrintDecorator.h"
|
||||||
|
|
||||||
size_t IndentedPrintDecorator::write(uint8_t c)
|
size_t PrettyPrintDecorator::write(uint8_t c)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
@ -85,7 +85,7 @@ size_t IndentedPrintDecorator::write(uint8_t c)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t IndentedPrintDecorator::writeln()
|
size_t PrettyPrintDecorator::writeln()
|
||||||
{
|
{
|
||||||
size_t n = sink.write('\n');
|
size_t n = sink.write('\n');
|
||||||
|
|
@ -8,11 +8,11 @@
|
|||||||
|
|
||||||
#include "Print.h"
|
#include "Print.h"
|
||||||
|
|
||||||
class IndentedPrintDecorator : public Print
|
class PrettyPrintDecorator : public Print
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
IndentedPrintDecorator(Print& p)
|
PrettyPrintDecorator(Print& p)
|
||||||
: indent(0), sink(p)
|
: indent(0), sink(p)
|
||||||
{
|
{
|
||||||
previousChar = 0;
|
previousChar = 0;
|
@ -85,9 +85,9 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="EscapedStringTests.cpp" />
|
<ClCompile Include="EscapedStringTests.cpp" />
|
||||||
<ClCompile Include="Intented_Array_Tests.cpp" />
|
<ClCompile Include="PrettyPrint_Array_Tests.cpp" />
|
||||||
<ClCompile Include="Intented_Object_Tests.cpp" />
|
<ClCompile Include="PrettyPrint_Object_Tests.cpp" />
|
||||||
<ClCompile Include="Intented_String_Tests.cpp" />
|
<ClCompile Include="PrettyPrint_String_Tests.cpp" />
|
||||||
<ClCompile Include="Issue10.cpp" />
|
<ClCompile Include="Issue10.cpp" />
|
||||||
<ClCompile Include="JsonArrayTests.cpp" />
|
<ClCompile Include="JsonArrayTests.cpp" />
|
||||||
<ClCompile Include="JsonObject_Indexer_Tests.cpp" />
|
<ClCompile Include="JsonObject_Indexer_Tests.cpp" />
|
||||||
|
@ -39,13 +39,13 @@
|
|||||||
<ClCompile Include="Issue10.cpp">
|
<ClCompile Include="Issue10.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Intented_Array_Tests.cpp">
|
<ClCompile Include="PrettyPrint_Array_Tests.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Intented_Object_Tests.cpp">
|
<ClCompile Include="PrettyPrint_Object_Tests.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Intented_String_Tests.cpp">
|
<ClCompile Include="PrettyPrint_String_Tests.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "CppUnitTest.h"
|
#include "CppUnitTest.h"
|
||||||
#include "IndentedPrintDecorator.h"
|
#include "PrettyPrintDecorator.h"
|
||||||
#include "StringBuilder.h"
|
#include "StringBuilder.h"
|
||||||
|
|
||||||
using namespace ArduinoJson::Internals;
|
using namespace ArduinoJson::Internals;
|
||||||
@ -12,7 +12,7 @@ using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
|||||||
|
|
||||||
namespace JsonGeneratorTests
|
namespace JsonGeneratorTests
|
||||||
{
|
{
|
||||||
TEST_CLASS(Indented_Array_Tests)
|
TEST_CLASS(PrettyPrint_Array_Tests)
|
||||||
{
|
{
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
size_t returnValue;
|
size_t returnValue;
|
||||||
@ -75,7 +75,7 @@ namespace JsonGeneratorTests
|
|||||||
void whenInputIs(const char input[])
|
void whenInputIs(const char input[])
|
||||||
{
|
{
|
||||||
StringBuilder sb(buffer, sizeof(buffer));
|
StringBuilder sb(buffer, sizeof(buffer));
|
||||||
IndentedPrintDecorator decorator(sb);
|
PrettyPrintDecorator decorator(sb);
|
||||||
|
|
||||||
returnValue = decorator.print(input);
|
returnValue = decorator.print(input);
|
||||||
}
|
}
|
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "CppUnitTest.h"
|
#include "CppUnitTest.h"
|
||||||
#include "IndentedPrintDecorator.h"
|
#include "PrettyPrintDecorator.h"
|
||||||
#include "StringBuilder.h"
|
#include "StringBuilder.h"
|
||||||
|
|
||||||
using namespace ArduinoJson::Internals;
|
using namespace ArduinoJson::Internals;
|
||||||
@ -12,7 +12,7 @@ using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
|||||||
|
|
||||||
namespace JsonGeneratorTests
|
namespace JsonGeneratorTests
|
||||||
{
|
{
|
||||||
TEST_CLASS(Indented_Object_Tests)
|
TEST_CLASS(PrettyPrint_Object_Tests)
|
||||||
{
|
{
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
size_t returnValue;
|
size_t returnValue;
|
||||||
@ -73,7 +73,7 @@ namespace JsonGeneratorTests
|
|||||||
void whenInputIs(const char input[])
|
void whenInputIs(const char input[])
|
||||||
{
|
{
|
||||||
StringBuilder sb(buffer, sizeof(buffer));
|
StringBuilder sb(buffer, sizeof(buffer));
|
||||||
IndentedPrintDecorator decorator(sb);
|
PrettyPrintDecorator decorator(sb);
|
||||||
|
|
||||||
returnValue = decorator.print(input);
|
returnValue = decorator.print(input);
|
||||||
}
|
}
|
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "CppUnitTest.h"
|
#include "CppUnitTest.h"
|
||||||
#include "IndentedPrintDecorator.h"
|
#include "PrettyPrintDecorator.h"
|
||||||
#include "StringBuilder.h"
|
#include "StringBuilder.h"
|
||||||
|
|
||||||
using namespace ArduinoJson::Internals;
|
using namespace ArduinoJson::Internals;
|
||||||
@ -12,7 +12,7 @@ using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
|||||||
|
|
||||||
namespace JsonGeneratorTests
|
namespace JsonGeneratorTests
|
||||||
{
|
{
|
||||||
TEST_CLASS(Intented_String_Tests)
|
TEST_CLASS(PrettyPrint_String_Tests)
|
||||||
{
|
{
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
size_t returnValue;
|
size_t returnValue;
|
||||||
@ -36,7 +36,7 @@ namespace JsonGeneratorTests
|
|||||||
void whenInputIs(const char input[])
|
void whenInputIs(const char input[])
|
||||||
{
|
{
|
||||||
StringBuilder sb(buffer, sizeof(buffer));
|
StringBuilder sb(buffer, sizeof(buffer));
|
||||||
IndentedPrintDecorator decorator(sb);
|
PrettyPrintDecorator decorator(sb);
|
||||||
|
|
||||||
returnValue = decorator.print(input);
|
returnValue = decorator.print(input);
|
||||||
}
|
}
|
Reference in New Issue
Block a user