Browse Source

Moved IndentedPrint into the namespace ArduinoJson::Generator

Benoit Blanchon 11 năm trước cách đây
mục cha
commit
aa2cd0db00
2 tập tin đã thay đổi với 25 bổ sung17 xóa
  1. 2 0
      JsonGenerator/IndentedPrint.cpp
  2. 23 17
      JsonGenerator/IndentedPrint.h

+ 2 - 0
JsonGenerator/IndentedPrint.cpp

@@ -1,5 +1,7 @@
 #include "IndentedPrint.h"
 
+using namespace ArduinoJson::Generator;
+
 void IndentedPrint::indent()
 {
     if (level<127)

+ 23 - 17
JsonGenerator/IndentedPrint.h

@@ -7,27 +7,33 @@
 
 #include "Print.h"
 
-class IndentedPrint : public Print
+namespace ArduinoJson
 {
-public:
-    
-    IndentedPrint(Print& p)
-        : sink(p)
+    namespace Generator
     {
-        level = 0;
-        isNewLine = true;
-    }
+        class IndentedPrint : public Print
+        {
+        public:
+
+            IndentedPrint(Print& p)
+                : sink(p)
+            {
+                level = 0;
+                isNewLine = true;
+            }
 
-    virtual size_t write(uint8_t);
+            virtual size_t write(uint8_t);
 
-    void indent();
-    void unindent();
+            void indent();
+            void unindent();
 
-private:
-    Print& sink;
-    uint8_t level : 7;
-    bool isNewLine : 1;
+        private:
+            Print& sink;
+            uint8_t level : 7;
+            bool isNewLine : 1;
 
-    size_t writeTabs();
-};
+            size_t writeTabs();
+        };
+    }
+}