Reorganized polyfills

This commit is contained in:
Benoit Blanchon
2018-05-17 13:46:23 +02:00
parent 4592f23260
commit 58cb793c96
62 changed files with 431 additions and 378 deletions

View File

@@ -0,0 +1,17 @@
// ArduinoJson - arduinojson.org
// Copyright Benoit Blanchon 2014-2018
// MIT License
#pragma once
#include "../Polyfills/type_traits.hpp"
namespace ArduinoJson {
namespace Internals {
class JsonVariantTag {};
template <typename T>
struct IsVariant : is_base_of<JsonVariantTag, T> {};
} // namespace Internals
} // namespace ArduinoJson

View File

@@ -6,8 +6,8 @@
#include "../JsonVariant.hpp"
#include "../Memory/JsonBuffer.hpp"
#include "../Polyfills/type_traits.hpp"
#include "../Strings/StringTraits.hpp"
#include "../TypeTraits/EnableIf.hpp"
namespace ArduinoJson {
namespace Internals {
@@ -23,7 +23,7 @@ struct ValueSaver {
template <typename Source>
struct ValueSaver<
Source, typename EnableIf<StringTraits<Source>::should_duplicate>::type> {
Source, typename enable_if<StringTraits<Source>::should_duplicate>::type> {
template <typename Destination>
static bool save(JsonBuffer* buffer, Destination& dest, Source source) {
if (!StringTraits<Source>::is_null(source)) {
@@ -41,7 +41,7 @@ struct ValueSaver<
// const char*, const signed char*, const unsigned char*
template <typename Char>
struct ValueSaver<
Char*, typename EnableIf<!StringTraits<Char*>::should_duplicate>::type> {
Char*, typename enable_if<!StringTraits<Char*>::should_duplicate>::type> {
template <typename Destination>
static bool save(JsonBuffer*, Destination& dest, Char* source) {
dest = reinterpret_cast<const char*>(source);