Added support for Printable (closes #1444)

This commit is contained in:
Benoit Blanchon
2021-03-27 14:35:15 +01:00
parent d7f5b56ca4
commit 347ac422f4
8 changed files with 224 additions and 3 deletions

View File

@@ -244,16 +244,26 @@ class VariantData {
setType(VALUE_IS_NULL);
}
void setStringPointer(const char *s, storage_policies::store_by_copy) {
void setOwnedString(const char *s) {
ARDUINOJSON_ASSERT(s != 0);
setType(VALUE_IS_OWNED_STRING);
_content.asString = s;
}
void setStringPointer(const char *s, storage_policies::store_by_address) {
void setLinkedString(const char *s) {
ARDUINOJSON_ASSERT(s != 0);
setType(VALUE_IS_LINKED_STRING);
_content.asString = s;
}
void setStringPointer(const char *s, storage_policies::store_by_copy) {
setOwnedString(s);
}
void setStringPointer(const char *s, storage_policies::store_by_address) {
setLinkedString(s);
}
template <typename TAdaptedString>
bool setString(TAdaptedString value, MemoryPool *pool) {
return setString(value, pool, typename TAdaptedString::storage_policy());