Extracted storage_policy to improve coverage in string adapters

This commit is contained in:
Benoit Blanchon
2020-02-16 16:10:56 +01:00
parent 0814fc185f
commit 58298ec5ba
10 changed files with 59 additions and 43 deletions

View File

@@ -5,6 +5,7 @@
#pragma once
#include <ArduinoJson/Polyfills/pgmspace.hpp>
#include <ArduinoJson/Strings/StoragePolicy.hpp>
namespace ARDUINOJSON_NAMESPACE {
@@ -40,19 +41,13 @@ class FlashStringAdapter {
return dup;
}
const char* data() const {
return 0;
}
size_t size() const {
if (!_str)
return 0;
return strlen_P(reinterpret_cast<const char*>(_str));
}
bool isStatic() const {
return false;
}
typedef storage_policy::store_by_copy storage_policy;
private:
const __FlashStringHelper* _str;