Add a stub for StaticJsonDocument

This commit is contained in:
Benoit Blanchon
2023-08-10 09:54:28 +02:00
parent bc6707b10c
commit ea5b019552
5 changed files with 95 additions and 0 deletions
+16
View File
@@ -9,16 +9,32 @@
# define FORCE_INLINE // __forceinline causes C4714 when returning std::string
# define NO_INLINE __declspec(noinline)
# ifndef ARDUINOJSON_DEPRECATED
# define ARDUINOJSON_DEPRECATED(msg) __declspec(deprecated(msg))
# endif
#elif defined(__GNUC__) // GCC or Clang
# define FORCE_INLINE __attribute__((always_inline))
# define NO_INLINE __attribute__((noinline))
# ifndef ARDUINOJSON_DEPRECATED
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
# define ARDUINOJSON_DEPRECATED(msg) __attribute__((deprecated(msg)))
# else
# define ARDUINOJSON_DEPRECATED(msg) __attribute__((deprecated))
# endif
# endif
#else // Other compilers
# define FORCE_INLINE
# define NO_INLINE
# ifndef ARDUINOJSON_DEPRECATED
# define ARDUINOJSON_DEPRECATED(msg)
# endif
#endif
#if defined(__has_attribute)
+20
View File
@@ -4,6 +4,8 @@
//
// clang-format off
#include <ArduinoJson/Namespace.hpp>
#ifdef __GNUC__
#define ARDUINOJSON_PRAGMA(x) _Pragma(#x)
@@ -23,3 +25,21 @@
#define ARDUINOJSON_NAMESPACE _Pragma ("GCC warning \"ARDUINOJSON_NAMESPACE is deprecated, use ArduinoJson instead\"") ArduinoJson
#endif
// clang-format on
ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE
// DEPRECATED: use JsonDocument instead
template <size_t N>
class ARDUINOJSON_DEPRECATED("use JsonDocument instead") StaticJsonDocument
: public JsonDocument {
public:
using JsonDocument::JsonDocument;
size_t capacity() const {
return N;
}
};
ARDUINOJSON_END_PUBLIC_NAMESPACE