mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-01 00:38:27 +01:00
Attach copy policy to string adapters
This commit is contained in:
@@ -10,8 +10,21 @@
|
||||
|
||||
namespace ARDUINOJSON_NAMESPACE {
|
||||
|
||||
inline SizedRamString adaptString(const String& s) {
|
||||
return SizedRamString(s.c_str(), s.size());
|
||||
class JsonStringAdapter : public SizedRamString {
|
||||
public:
|
||||
JsonStringAdapter(const String& s)
|
||||
: SizedRamString(s.c_str(), s.size()), _linked(s.isLinked()) {}
|
||||
|
||||
LinkOrCopyStringStoragePolicy storagePolicy() {
|
||||
return LinkOrCopyStringStoragePolicy(_linked);
|
||||
}
|
||||
|
||||
private:
|
||||
bool _linked;
|
||||
};
|
||||
|
||||
inline JsonStringAdapter adaptString(const String& s) {
|
||||
return JsonStringAdapter(s);
|
||||
}
|
||||
|
||||
template <>
|
||||
|
||||
Reference in New Issue
Block a user