mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Renamed PrettyPrintDecorator into JsonPrettyPrint
This commit is contained in:
		| @@ -13,7 +13,7 @@ | ||||
|   <ItemGroup> | ||||
|     <ClInclude Include="EscapedString.h" /> | ||||
|     <ClInclude Include="IndentedPrint.h" /> | ||||
|     <ClInclude Include="PrettyPrintDecorator.h" /> | ||||
|     <ClInclude Include="JsonPrettyPrint.h" /> | ||||
|     <ClInclude Include="JsonArray.h" /> | ||||
|     <ClInclude Include="JsonArrayBase.h" /> | ||||
|     <ClInclude Include="JsonObject.h" /> | ||||
| @@ -27,7 +27,7 @@ | ||||
|   <ItemGroup> | ||||
|     <ClCompile Include="EscapedString.cpp" /> | ||||
|     <ClCompile Include="IndentedPrint.cpp" /> | ||||
|     <ClCompile Include="PrettyPrintDecorator.cpp" /> | ||||
|     <ClCompile Include="JsonPrettyPrint.cpp" /> | ||||
|     <ClCompile Include="JsonArrayBase.cpp" /> | ||||
|     <ClCompile Include="JsonObjectBase.cpp" /> | ||||
|     <ClCompile Include="JsonValue.cpp" /> | ||||
|   | ||||
| @@ -45,10 +45,10 @@ | ||||
|     <ClInclude Include="JsonObject.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="PrettyPrintDecorator.h"> | ||||
|     <ClInclude Include="IndentedPrint.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="IndentedPrint.h"> | ||||
|     <ClInclude Include="JsonPrettyPrint.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|   </ItemGroup> | ||||
| @@ -71,10 +71,10 @@ | ||||
|     <ClCompile Include="JsonObjectBase.cpp"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="PrettyPrintDecorator.cpp"> | ||||
|     <ClCompile Include="IndentedPrint.cpp"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="IndentedPrint.cpp"> | ||||
|     <ClCompile Include="JsonPrettyPrint.cpp"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|   </ItemGroup> | ||||
|   | ||||
| @@ -3,18 +3,18 @@ | ||||
| * Benoit Blanchon 2014 - MIT License | ||||
| */ | ||||
| 
 | ||||
| #include "PrettyPrintDecorator.h" | ||||
| #include "JsonPrettyPrint.h" | ||||
| 
 | ||||
| using namespace ArduinoJson::Generator; | ||||
| 
 | ||||
| size_t PrettyPrintDecorator::write(uint8_t c) | ||||
| size_t JsonPrettyPrint::write(uint8_t c) | ||||
| { | ||||
|     size_t n = inString ? handleStringChar(c) : handleMarkupChar(c);     | ||||
|     previousChar = c; | ||||
|     return n; | ||||
| } | ||||
| 
 | ||||
| size_t PrettyPrintDecorator::handleStringChar(uint8_t c) | ||||
| size_t JsonPrettyPrint::handleStringChar(uint8_t c) | ||||
| { | ||||
|     bool isQuote = c == '"' && previousChar != '\\'; | ||||
| 
 | ||||
| @@ -23,7 +23,7 @@ size_t PrettyPrintDecorator::handleStringChar(uint8_t c) | ||||
|     return sink.write(c); | ||||
| } | ||||
| 
 | ||||
| size_t PrettyPrintDecorator::handleMarkupChar(uint8_t c) | ||||
| size_t JsonPrettyPrint::handleMarkupChar(uint8_t c) | ||||
| { | ||||
|     switch (c) | ||||
|     { | ||||
| @@ -49,38 +49,38 @@ size_t PrettyPrintDecorator::handleMarkupChar(uint8_t c) | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| size_t PrettyPrintDecorator::handleBlockOpen(uint8_t c) | ||||
| size_t JsonPrettyPrint::handleBlockOpen(uint8_t c) | ||||
| { | ||||
|     return indentIfNeeded() + sink.write(c); | ||||
| } | ||||
| 
 | ||||
| size_t PrettyPrintDecorator::handleBlockClose(uint8_t c) | ||||
| size_t JsonPrettyPrint::handleBlockClose(uint8_t c) | ||||
| {   | ||||
|     return unindentIfNeeded() + sink.write(c); | ||||
| } | ||||
| 
 | ||||
| size_t PrettyPrintDecorator::handleColumn() | ||||
| size_t JsonPrettyPrint::handleColumn() | ||||
| { | ||||
|     return sink.write(':') + sink.write(' '); | ||||
| } | ||||
| 
 | ||||
| size_t PrettyPrintDecorator::handleComma() | ||||
| size_t JsonPrettyPrint::handleComma() | ||||
| { | ||||
|     return sink.write(',') + sink.println(); | ||||
| } | ||||
| 
 | ||||
| size_t PrettyPrintDecorator::handleQuoteOpen() | ||||
| size_t JsonPrettyPrint::handleQuoteOpen() | ||||
| { | ||||
|     inString = true; | ||||
|     return indentIfNeeded() + sink.write('"'); | ||||
| } | ||||
| 
 | ||||
| size_t PrettyPrintDecorator::handleNormalChar(uint8_t c) | ||||
| size_t JsonPrettyPrint::handleNormalChar(uint8_t c) | ||||
| { | ||||
|     return indentIfNeeded() + sink.write(c); | ||||
| } | ||||
| 
 | ||||
| size_t PrettyPrintDecorator::indentIfNeeded() | ||||
| size_t JsonPrettyPrint::indentIfNeeded() | ||||
| { | ||||
|     if (!inEmptyBlock()) return 0; | ||||
| 
 | ||||
| @@ -88,7 +88,7 @@ size_t PrettyPrintDecorator::indentIfNeeded() | ||||
|     return sink.println(); | ||||
| } | ||||
| 
 | ||||
| size_t PrettyPrintDecorator::unindentIfNeeded() | ||||
| size_t JsonPrettyPrint::unindentIfNeeded() | ||||
| { | ||||
|     if (inEmptyBlock()) return 0; | ||||
| 
 | ||||
| @@ -12,11 +12,11 @@ namespace ArduinoJson | ||||
| { | ||||
|     namespace Generator | ||||
|     { | ||||
|         class PrettyPrintDecorator : public Print | ||||
|         class JsonPrettyPrint : public Print | ||||
|         { | ||||
|         public: | ||||
| 
 | ||||
|             PrettyPrintDecorator(IndentedPrint& p) | ||||
|             JsonPrettyPrint(IndentedPrint& p) | ||||
|                 : sink(p) | ||||
|             { | ||||
|                 previousChar = 0; | ||||
| @@ -8,7 +8,7 @@ | ||||
| #include "JsonValue.h" | ||||
| #include "Print.h" | ||||
| #include "Printable.h" | ||||
| #include "PrettyPrintDecorator.h" | ||||
| #include "JsonPrettyPrint.h" | ||||
|  | ||||
| namespace ArduinoJson | ||||
| { | ||||
| @@ -28,7 +28,7 @@ namespace ArduinoJson | ||||
|  | ||||
|             size_t prettyPrintTo(IndentedPrint& p) const | ||||
|             { | ||||
|                 PrettyPrintDecorator decorator(p); | ||||
|                 JsonPrettyPrint decorator(p); | ||||
|                 return printTo(decorator); | ||||
|             } | ||||
|  | ||||
|   | ||||
| @@ -4,7 +4,7 @@ | ||||
| */ | ||||
|  | ||||
| #include "CppUnitTest.h" | ||||
| #include "PrettyPrintDecorator.h" | ||||
| #include "JsonPrettyPrint.h" | ||||
| #include "StringBuilder.h" | ||||
|  | ||||
| using namespace ArduinoJson::Internals; | ||||
| @@ -77,7 +77,7 @@ namespace JsonGeneratorTests | ||||
|         { | ||||
|             StringBuilder sb(buffer, sizeof(buffer)); | ||||
|             IndentedPrint indentedPrint(sb); | ||||
|             PrettyPrintDecorator decorator(indentedPrint); | ||||
|             JsonPrettyPrint decorator(indentedPrint); | ||||
|  | ||||
|             returnValue = decorator.print(input); | ||||
|         } | ||||
|   | ||||
| @@ -4,7 +4,7 @@ | ||||
| */ | ||||
|  | ||||
| #include "CppUnitTest.h" | ||||
| #include "PrettyPrintDecorator.h" | ||||
| #include "JsonPrettyPrint.h" | ||||
| #include "StringBuilder.h" | ||||
|  | ||||
| using namespace ArduinoJson::Internals; | ||||
| @@ -75,7 +75,7 @@ namespace JsonGeneratorTests | ||||
|         { | ||||
|             StringBuilder sb(buffer, sizeof(buffer)); | ||||
|             IndentedPrint indentedPrint(sb); | ||||
|             PrettyPrintDecorator decorator(indentedPrint); | ||||
|             JsonPrettyPrint decorator(indentedPrint); | ||||
|  | ||||
|             returnValue = decorator.print(input); | ||||
|         } | ||||
|   | ||||
| @@ -4,7 +4,7 @@ | ||||
| */ | ||||
|  | ||||
| #include "CppUnitTest.h" | ||||
| #include "PrettyPrintDecorator.h" | ||||
| #include "JsonPrettyPrint.h" | ||||
| #include "StringBuilder.h" | ||||
|  | ||||
| using namespace ArduinoJson::Internals; | ||||
| @@ -62,7 +62,7 @@ namespace JsonGeneratorTests | ||||
|         { | ||||
|             StringBuilder sb(buffer, sizeof(buffer)); | ||||
|             IndentedPrint indentedPrint(sb); | ||||
|             PrettyPrintDecorator decorator(indentedPrint); | ||||
|             JsonPrettyPrint decorator(indentedPrint); | ||||
|  | ||||
|             returnValue = decorator.print(input); | ||||
|         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user