Răsfoiți Sursa

Defined the DEPRECATED macro

Benoît Blanchon 11 ani în urmă
părinte
comite
7487b8cbb7

+ 1 - 0
JsonParser.cpp

@@ -9,4 +9,5 @@
 #include "JsonParser/JsonHashTable.cpp"
 #include "JsonParser/JsonObjectBase.cpp"
 #include "JsonParser/JsonParserBase.cpp"
+#include "JsonParser/JsonValue.cpp"
 #include "JsonParser/jsmn.cpp"

+ 1 - 1
JsonParser/JsonArray.cpp

@@ -31,7 +31,7 @@ JsonValue JsonArray::operator[](int index)
 }
 
 
-JsonHashTable JsonArray::getHashTable(int index) DEPRECATED
+DEPRECATED JsonHashTable JsonArray::getHashTable(int index)
 {
     return (JsonHashTable) (*this)[index];
 }

+ 6 - 8
JsonParser/JsonArray.h

@@ -8,8 +8,6 @@
 #include "JsonObjectBase.h"
 #include "JsonValue.h"
 
-#define DEPRECATED
-
 namespace ArduinoJson
 {
     namespace Parser
@@ -37,29 +35,29 @@ namespace ArduinoJson
 
             JsonValue operator[](int index);
                       
-            JsonArray getArray(int index) DEPRECATED
+            DEPRECATED JsonArray getArray(int index)
             {
                 return (JsonArray) (*this)[index];
             }
 
-            bool getBool(int index) DEPRECATED
+            DEPRECATED bool getBool(int index)
             {
                 return (bool) (*this)[index];
             }
 
-            double getDouble(int index) DEPRECATED
+            DEPRECATED double getDouble(int index)
             {
                 return (double) (*this)[index];
             }
 
-            JsonHashTable getHashTable(int index) DEPRECATED;
+            DEPRECATED JsonHashTable getHashTable(int index);
 
-            long getLong(int index) DEPRECATED
+            DEPRECATED long getLong(int index)
             {
                 return (long) (*this)[index];
             }
 
-            char* getString(int index) DEPRECATED
+            DEPRECATED char* getString(int index)
             {
                 return (char*) (*this)[index];
             }

+ 1 - 1
JsonParser/JsonHashTable.cpp

@@ -43,7 +43,7 @@ JsonValue JsonHashTable::operator [](const char* desiredKey)
     return JsonValue();
 }
 
-JsonArray JsonHashTable::getArray(const char* key) DEPRECATED
+DEPRECATED JsonArray JsonHashTable::getArray(const char* key)
 {
     return (JsonArray) (*this)[key];
 }

+ 6 - 8
JsonParser/JsonHashTable.h

@@ -8,8 +8,6 @@
 #include "JsonObjectBase.h"
 #include "JsonValue.h"
 
-#define DEPRECATED
-
 namespace ArduinoJson
 {
     namespace Parser
@@ -37,29 +35,29 @@ namespace ArduinoJson
                 return (*this)[key].success();
             }
 
-            JsonArray getArray(const char* key) DEPRECATED;
+            DEPRECATED JsonArray getArray(const char* key);
 
-            bool getBool(const char* key) DEPRECATED
+            DEPRECATED bool getBool(const char* key)
             {
                 return (bool) (*this)[key];
             }
 
-            double getDouble(const char* key) DEPRECATED
+            DEPRECATED double getDouble(const char* key)
             {
                 return (double) (*this)[key];
             }
 
-            JsonHashTable getHashTable(const char* key) DEPRECATED
+            DEPRECATED JsonHashTable getHashTable(const char* key)
             {
                 return (JsonHashTable) (*this)[key];
             }
 
-            long getLong(const char* key) DEPRECATED
+            DEPRECATED long getLong(const char* key)
             {
                 return (long) (*this)[key];
             }
 
-            char* getString(const char* key) DEPRECATED
+            DEPRECATED char* getString(const char* key)
             {
                 return (char*) (*this)[key];
             }

+ 8 - 0
JsonParser/JsonObjectBase.h

@@ -7,6 +7,14 @@
 
 #include "jsmn.h"
 
+#ifdef __GNUC__
+#define DEPRECATED __attribute__((deprecated))
+#elif defined(_MSC_VER)
+#define DEPRECATED __declspec(deprecated)
+#else
+#define DEPRECATED
+#endif
+
 namespace ArduinoJson
 {
     namespace Parser

+ 0 - 4
JsonParser/JsonValue.h

@@ -18,11 +18,7 @@ namespace ArduinoJson
 
         class JsonValue : public JsonObjectBase
         {
-            friend JsonArray;
-            friend JsonHashTable;
-
         public:
-
             JsonValue() {}
 
             JsonValue(char* json, jsmntok_t* tokens)