Przeglądaj źródła

Made EscapedString pure static

Benoit Blanchon 11 lat temu
rodzic
commit
09294cb5e6

+ 0 - 14
JsonGenerator/EscapedString.h

@@ -14,20 +14,6 @@ namespace ArduinoJson
         class EscapedString
         {
         public:
-
-            EscapedString(const char* s)
-                : rawString(s)
-            {                
-            }
-
-            size_t printTo(Print& p) const
-            {
-                return printTo(rawString, p);
-            }
-            
-        private:
-            const char* rawString;
-
             static size_t printTo(const char*, Print&);
         };
     }

+ 1 - 1
JsonGenerator/JsonObjectBase.cpp

@@ -20,7 +20,7 @@ size_t JsonObjectBase::printTo(Print& p) const
     const KeyValuePair* current = items;
     for (int i = count; i > 0; i--)
     {       
-        n += EscapedString(current->key).printTo(p);
+        n += EscapedString::printTo(current->key, p);
         n += p.write(':');
         n += current->value.printTo(p);
 

+ 1 - 1
JsonGenerator/JsonValue.cpp

@@ -31,5 +31,5 @@ size_t JsonValue::printPrintableTo(const Content& c, Print& p)
 
 size_t JsonValue::printStringTo(const Content& c, Print& p)
 {
-    return EscapedString(c.asString).printTo(p);
+    return EscapedString::printTo(c.asString, p);
 }

+ 1 - 2
JsonGeneratorTests/EscapedStringTests.cpp

@@ -83,8 +83,7 @@ namespace JsonGeneratorTests
         void whenInputIs(const char* input)
         {
             StringBuilder sb(buffer, sizeof(buffer));  
-            EscapedString escapedString = input;
-            returnValue = escapedString.printTo(sb);
+            returnValue = EscapedString::printTo(input, sb);
         }
 
         void outputMustBe(const char* expected)