mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-30 18:57:32 +02:00
JsonString: move adapter class in the same file
This commit is contained in:
@ -5,6 +5,7 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
#include <ArduinoJson/Strings/IsString.hpp>
|
#include <ArduinoJson/Strings/IsString.hpp>
|
||||||
|
#include <ArduinoJson/Strings/JsonString.hpp>
|
||||||
#include <ArduinoJson/Strings/StringAdapters.hpp>
|
#include <ArduinoJson/Strings/StringAdapters.hpp>
|
||||||
|
|
||||||
#include <catch.hpp>
|
#include <catch.hpp>
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
// ArduinoJson - https://arduinojson.org
|
|
||||||
// Copyright © 2014-2024, Benoit BLANCHON
|
|
||||||
// MIT License
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <ArduinoJson/Strings/Adapters/RamString.hpp>
|
|
||||||
#include <ArduinoJson/Strings/JsonString.hpp>
|
|
||||||
#include <ArduinoJson/Strings/StringAdapter.hpp>
|
|
||||||
|
|
||||||
ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct StringAdapter<JsonString> {
|
|
||||||
using AdaptedString = RamString;
|
|
||||||
|
|
||||||
static const AdaptedString& adapt(const JsonString& s) {
|
|
||||||
return s.str_;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ARDUINOJSON_END_PRIVATE_NAMESPACE
|
|
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <ArduinoJson/Strings/Adapters/RamString.hpp>
|
||||||
|
|
||||||
#if ARDUINOJSON_ENABLE_STD_STREAM
|
#if ARDUINOJSON_ENABLE_STD_STREAM
|
||||||
# include <ostream>
|
# include <ostream>
|
||||||
#endif
|
#endif
|
||||||
@ -81,4 +83,15 @@ class JsonString {
|
|||||||
detail::RamString str_;
|
detail::RamString str_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace detail {
|
||||||
|
template <>
|
||||||
|
struct StringAdapter<JsonString> {
|
||||||
|
using AdaptedString = RamString;
|
||||||
|
|
||||||
|
static const AdaptedString& adapt(const JsonString& s) {
|
||||||
|
return s.str_;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} // namespace detail
|
||||||
|
|
||||||
ARDUINOJSON_END_PUBLIC_NAMESPACE
|
ARDUINOJSON_END_PUBLIC_NAMESPACE
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ArduinoJson/Polyfills/type_traits.hpp>
|
#include <ArduinoJson/Polyfills/type_traits.hpp>
|
||||||
#include <ArduinoJson/Strings/Adapters/JsonString.hpp>
|
|
||||||
#include <ArduinoJson/Strings/Adapters/RamString.hpp>
|
#include <ArduinoJson/Strings/Adapters/RamString.hpp>
|
||||||
#include <ArduinoJson/Strings/Adapters/StringObject.hpp>
|
#include <ArduinoJson/Strings/Adapters/StringObject.hpp>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user