mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 08:42:39 +01:00 
			
		
		
		
	Added comments
This commit is contained in:
		| @@ -11,6 +11,9 @@ namespace ArduinoJson | ||||
| { | ||||
|     namespace Generator | ||||
|     { | ||||
|         // Decorator on top of Print to allow indented output. | ||||
|         // This class is used by JsonPrintable::prettyPrintTo() but can also be used | ||||
|         // for your own purpose, like logging. | ||||
|         class IndentedPrint : public Print | ||||
|         { | ||||
|         public: | ||||
| @@ -25,8 +28,13 @@ namespace ArduinoJson | ||||
|  | ||||
|             virtual size_t write(uint8_t); | ||||
|  | ||||
|             // Adds one level of indentation | ||||
|             void indent(); | ||||
|  | ||||
|             // Removes one level of indentation | ||||
|             void unindent(); | ||||
|  | ||||
|             // Set the number of space printed for each level of indentation | ||||
|             void setTabSize(uint8_t n); | ||||
|  | ||||
|         private: | ||||
|   | ||||
| @@ -12,6 +12,7 @@ namespace ArduinoJson | ||||
| { | ||||
|     namespace Generator | ||||
|     { | ||||
|         // Converts a compact JSON string into an indented one. | ||||
|         class JsonPrettyPrint : public Print | ||||
|         { | ||||
|         public: | ||||
|   | ||||
| @@ -13,16 +13,27 @@ namespace ArduinoJson | ||||
| { | ||||
|     namespace Generator | ||||
|     { | ||||
|         // Contains methods to generate a JSON string. | ||||
|         // Implemented by both JsonObject and JsonArray | ||||
|         class JsonPrintable : public Printable | ||||
|         { | ||||
|         public: | ||||
|  | ||||
|             // Generates the compact JSON string and sends it to a Print stream  | ||||
|             virtual size_t printTo(Print& p) const = 0; | ||||
|  | ||||
|             // Generates the compact JSON string and writes it in a buffer | ||||
|             size_t printTo(char* buffer, size_t bufferSize) const; | ||||
|  | ||||
|             size_t prettyPrintTo(IndentedPrint& p) const; | ||||
|             // Generates the indented JSON string and sends it to a Print stream | ||||
|             size_t prettyPrintTo(Print& p) const; | ||||
|  | ||||
|             // Generates the indented JSON string and sends it to a IndentedPrint stream | ||||
|             // This overload allows a finer control of the output because you can customize | ||||
|             // the IndentedPrint. | ||||
|             size_t prettyPrintTo(IndentedPrint& p) const; | ||||
|  | ||||
|             // Generates the indented JSON string and writes it in a buffer | ||||
|             size_t prettyPrintTo(char* buffer, size_t bufferSize) const; | ||||
|         }; | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user