8000 Added comments · MacroBull/ArduinoJson@58c051f · GitHub
[go: up one dir, main page]

Skip to content

Commit 58c051f

Browse files
committed
Added comments
1 parent 763aa7f commit 58c051f

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

JsonGenerator/IndentedPrint.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ namespace ArduinoJson
1111
{
1212
namespace Generator
1313
{
14+
// Decorator on top of Print to allow indented output.
15+
// This class is used by JsonPrintable::prettyPrintTo() but can also be used
16+
// for your own purpose, like logging.
1417
class IndentedPrint : public Print
1518
{
1619
public:
@@ -25,8 +28,13 @@ namespace ArduinoJson
2528

2629
virtual size_t write(uint8_t);
2730

31+
// Adds one level of indentation
2832
void indent();
33+
34+
// Removes one level of indentation
2935
void unindent();
36+
37+
// Set the number of space printed for each level of indentation
3038
void setTabSize(uint8_t n);
3139

3240
private:

JsonGenerator/JsonPrettyPrint.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ namespace ArduinoJson
1212
{
1313
namespace Generator
1414
{
15+
// Converts a compact JSON string into an indented one.
1516
class JsonPrettyPrint : public Print
1617
{
1718
public:

JsonGenerator/JsonPrintable.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,27 @@ namespace ArduinoJson
1313
{
1414
namespace Generator
1515
{
16+
// Contains methods to generate a JSON string.
17+
// Implemented by both JsonObject and JsonArray
1618
class JsonPrintable : public Printable
1719
{
1820
public:
1921

22+
// Generates the compact JSON string and sends it to a Print stream
2023
virtual size_t printTo(Print& p) const = 0;
2124

25+
// Generates the compact JSON string and writes it in a buffer
2226
size_t printTo(char* buffer, size_t bufferSize) const;
2327

24-
size_t prettyPrintTo(IndentedPrint& p) const;
28+
// Generates the indented JSON string and sends it to a Print stream
2529
size_t prettyPrintTo(Print& p) const;
30+
31+
// Generates the indented JSON string and sends it to a IndentedPrint stream
32+
// This overload allows a finer control of the output because you can customize
33+
// the IndentedPrint.
34+
size_t prettyPrintTo(IndentedPrint& p) const;
35+
36+
// Generates the indented JSON string and writes it in a buffer
2637
size_t prettyPrintTo(char* buffer, size_t bufferSize) const;
2738
};
2839
}

0 commit comments

Comments
 (0)
0