X-Git-Url: https://git.efficios.com/?a=blobdiff_plain;f=src%2Fcpp-common%2Fbt2%2Fvalue.hpp;h=7388c3403a7558c0e94fefcd8527a2fdac80c249;hb=bd6e66fd0c3012ad6bcb03cdb3fb687767fb6ccf;hp=62a81cf94b894ec9f45c2f14f878e1e0d4f57680;hpb=a633d3ac916e2e952d89c4449fc98f96461eb010;p=babeltrace.git diff --git a/src/cpp-common/bt2/value.hpp b/src/cpp-common/bt2/value.hpp index 62a81cf9..7388c340 100644 --- a/src/cpp-common/bt2/value.hpp +++ b/src/cpp-common/bt2/value.hpp @@ -15,13 +15,14 @@ #include "common/assert.h" #include "common/common.h" -#include "cpp-common/optional.hpp" -#include "cpp-common/string_view.hpp" +#include "cpp-common/bt2c/c-string-view.hpp" #include "borrowed-object-iterator.hpp" #include "borrowed-object.hpp" #include "exc.hpp" #include "internal/utils.hpp" +#include "optional-borrowed-object.hpp" +#include "raw-value-proxy.hpp" #include "shared-object.hpp" namespace bt2 { @@ -81,6 +82,30 @@ enum class ValueType MAP = BT_VALUE_TYPE_MAP, }; +template +class CommonValueRawValueProxy final +{ +public: + explicit CommonValueRawValueProxy(const ValueObjT obj) : _mObj {obj} + { + } + + CommonValueRawValueProxy& operator=(bool rawVal) noexcept; + CommonValueRawValueProxy& operator=(std::int64_t rawVal) noexcept; + CommonValueRawValueProxy& operator=(std::uint64_t rawVal) noexcept; + CommonValueRawValueProxy& operator=(double rawVal) noexcept; + CommonValueRawValueProxy& operator=(const char *rawVal); + CommonValueRawValueProxy& operator=(bt2c::CStringView rawVal); + operator bool() const noexcept; + operator std::int64_t() const noexcept; + operator std::uint64_t() const noexcept; + operator double() const noexcept; + operator bt2c::CStringView() const noexcept; + +private: + ValueObjT _mObj; +}; + template class CommonValue : public BorrowedObject { @@ -88,13 +113,13 @@ private: using typename BorrowedObject::_ThisBorrowedObject; protected: - using typename BorrowedObject::_LibObjPtr; using _ThisCommonValue = CommonValue; public: + using typename BorrowedObject::LibObjPtr; using Shared = SharedValue, LibObjT>; - explicit CommonValue(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr} + explicit CommonValue(const LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr} { } @@ -104,7 +129,7 @@ public: } template - _ThisCommonValue& operator=(const CommonValue val) noexcept + _ThisCommonValue operator=(const CommonValue val) noexcept { _ThisBorrowedObject::operator=(val); return *this; @@ -177,6 +202,66 @@ public: return !(*this == other); } + CommonValueRawValueProxy operator*() const noexcept + { + return CommonValueRawValueProxy {*this}; + } + + std::uint64_t arrayLength() const noexcept + { + return this->asArray().length(); + } + + bool arrayIsEmpty() const noexcept + { + return this->asArray().isEmpty(); + } + + CommonValue operator[](const std::uint64_t index) const noexcept + { + return this->asArray()[index]; + } + + template + void append(T&& elem) const + { + this->asArray().append(std::forward(elem)); + } + + CommonArrayValue appendEmptyArray() const; + CommonMapValue appendEmptyMap() const; + + std::uint64_t mapLength() const noexcept + { + return this->asMap().length(); + } + + bool mapIsEmpty() const noexcept + { + return this->asMap().isEmpty(); + } + + template + OptionalBorrowedObject> operator[](KeyT&& key) const noexcept + { + return this->asMap()[std::forward(key)]; + } + + template + bool hasEntry(KeyT&& key) const noexcept + { + return this->asMap().hasEntry(std::forward(key)); + } + + template + void insert(KeyT&& key, ValT&& val) const + { + this->asMap().insert(std::forward(key), std::forward(val)); + } + + CommonArrayValue insertEmptyArray(bt2c::CStringView key) const; + CommonMapValue insertEmptyMap(bt2c::CStringView key) const; + Shared shared() const noexcept { return Shared::createWithRef(*this); @@ -207,6 +292,84 @@ protected: using Value = CommonValue; using ConstValue = CommonValue; +template +CommonValueRawValueProxy& +CommonValueRawValueProxy::operator=(const bool rawVal) noexcept +{ + _mObj.asBool().value(rawVal); + return *this; +} + +template +CommonValueRawValueProxy& +CommonValueRawValueProxy::operator=(const std::int64_t rawVal) noexcept +{ + _mObj.asSignedInteger().value(rawVal); + return *this; +} + +template +CommonValueRawValueProxy& +CommonValueRawValueProxy::operator=(const std::uint64_t rawVal) noexcept +{ + _mObj.asUnsignedInteger().value(rawVal); + return *this; +} + +template +CommonValueRawValueProxy& +CommonValueRawValueProxy::operator=(const double rawVal) noexcept +{ + _mObj.asReal().value(rawVal); + return *this; +} + +template +CommonValueRawValueProxy& +CommonValueRawValueProxy::operator=(const char * const rawVal) +{ + _mObj.asString().value(rawVal); + return *this; +} + +template +CommonValueRawValueProxy& +CommonValueRawValueProxy::operator=(const bt2c::CStringView rawVal) +{ + _mObj.asString().value(rawVal); + return *this; +} + +template +CommonValueRawValueProxy::operator bool() const noexcept +{ + return _mObj.asBool().value(); +} + +template +CommonValueRawValueProxy::operator std::int64_t() const noexcept +{ + return _mObj.asSignedInteger().value(); +} + +template +CommonValueRawValueProxy::operator std::uint64_t() const noexcept +{ + return _mObj.asUnsignedInteger().value(); +} + +template +CommonValueRawValueProxy::operator double() const noexcept +{ + return _mObj.asReal().value(); +} + +template +CommonValueRawValueProxy::operator bt2c::CStringView() const noexcept +{ + return _mObj.asString().value(); +} + namespace internal { struct ValueTypeDescr @@ -246,7 +409,7 @@ public: } template - CommonNullValue& operator=(const CommonNullValue val) noexcept + CommonNullValue operator=(const CommonNullValue val) noexcept { _ThisCommonValue::operator=(val); return *this; @@ -290,14 +453,14 @@ template class CommonBoolValue final : public CommonValue { private: - using typename CommonValue::_LibObjPtr; using typename CommonValue::_ThisCommonValue; public: + using typename CommonValue::LibObjPtr; using Shared = SharedValue, LibObjT>; using Value = bool; - explicit CommonBoolValue(const _LibObjPtr libObjPtr) noexcept : _ThisCommonValue {libObjPtr} + explicit CommonBoolValue(const LibObjPtr libObjPtr) noexcept : _ThisCommonValue {libObjPtr} { BT_ASSERT_DBG(this->isBool()); } @@ -316,7 +479,7 @@ public: } template - CommonBoolValue& operator=(const CommonBoolValue val) noexcept + CommonBoolValue operator=(const CommonBoolValue val) noexcept { _ThisCommonValue::operator=(val); return *this; @@ -327,12 +490,9 @@ public: return CommonBoolValue {*this}; } - CommonBoolValue operator=(const Value rawVal) const noexcept + RawValueProxy operator*() const noexcept { - static_assert(!std::is_const::value, "Not available with `bt2::ConstBoolValue`."); - - bt_value_bool_set(this->libObjPtr(), static_cast(rawVal)); - return *this; + return RawValueProxy {*this}; } Value value() const noexcept @@ -340,9 +500,11 @@ public: return static_cast(bt_value_bool_get(this->libObjPtr())); } - operator Value() const noexcept + void value(const Value val) const noexcept { - return this->value(); + static_assert(!std::is_const::value, "Not available with `bt2::ConstBoolValue`."); + + bt_value_bool_set(this->libObjPtr(), static_cast(val)); } Shared shared() const noexcept @@ -378,14 +540,14 @@ template class CommonUnsignedIntegerValue final : public CommonValue { private: - using typename CommonValue::_LibObjPtr; using typename CommonValue::_ThisCommonValue; public: + using typename CommonValue::LibObjPtr; using Shared = SharedValue, LibObjT>; using Value = std::uint64_t; - explicit CommonUnsignedIntegerValue(const _LibObjPtr libObjPtr) noexcept : + explicit CommonUnsignedIntegerValue(const LibObjPtr libObjPtr) noexcept : _ThisCommonValue {libObjPtr} { BT_ASSERT_DBG(this->isUnsignedInteger()); @@ -406,7 +568,7 @@ public: } template - CommonUnsignedIntegerValue& + CommonUnsignedIntegerValue operator=(const CommonUnsignedIntegerValue val) noexcept { _ThisCommonValue::operator=(val); @@ -418,13 +580,17 @@ public: return CommonUnsignedIntegerValue {*this}; } - CommonUnsignedIntegerValue operator=(const Value rawVal) const noexcept + RawValueProxy operator*() const noexcept + { + return RawValueProxy {*this}; + } + + void value(const Value val) const noexcept { static_assert(!std::is_const::value, "Not available with `bt2::ConstUnsignedIntegerValue`."); - bt_value_integer_unsigned_set(this->libObjPtr(), rawVal); - return *this; + bt_value_integer_unsigned_set(this->libObjPtr(), val); } Value value() const noexcept @@ -432,11 +598,6 @@ public: return bt_value_integer_unsigned_get(this->libObjPtr()); } - operator Value() const noexcept - { - return this->value(); - } - Shared shared() const noexcept { return Shared::createWithRef(*this); @@ -470,14 +631,14 @@ template class CommonSignedIntegerValue final : public CommonValue { private: - using typename CommonValue::_LibObjPtr; using typename CommonValue::_ThisCommonValue; public: + using typename CommonValue::LibObjPtr; using Shared = SharedValue, LibObjT>; using Value = std::int64_t; - explicit CommonSignedIntegerValue(const _LibObjPtr libObjPtr) noexcept : + explicit CommonSignedIntegerValue(const LibObjPtr libObjPtr) noexcept : _ThisCommonValue {libObjPtr} { BT_ASSERT_DBG(this->isSignedInteger()); @@ -510,13 +671,17 @@ public: return CommonSignedIntegerValue {*this}; } - CommonSignedIntegerValue operator=(const Value rawVal) const noexcept + RawValueProxy operator*() const noexcept + { + return RawValueProxy {*this}; + } + + void value(const Value val) const noexcept { static_assert(!std::is_const::value, "Not available with `bt2::ConstSignedIntegerValue`."); - bt_value_integer_signed_set(this->libObjPtr(), rawVal); - return *this; + bt_value_integer_signed_set(this->libObjPtr(), val); } Value value() const noexcept @@ -524,11 +689,6 @@ public: return bt_value_integer_signed_get(this->libObjPtr()); } - operator Value() const noexcept - { - return this->value(); - } - Shared shared() const noexcept { return Shared::createWithRef(*this); @@ -562,14 +722,14 @@ template class CommonRealValue final : public CommonValue { private: - using typename CommonValue::_LibObjPtr; using typename CommonValue::_ThisCommonValue; public: + using typename CommonValue::LibObjPtr; using Shared = SharedValue, LibObjT>; using Value = double; - explicit CommonRealValue(const _LibObjPtr libObjPtr) noexcept : _ThisCommonValue {libObjPtr} + explicit CommonRealValue(const LibObjPtr libObjPtr) noexcept : _ThisCommonValue {libObjPtr} { BT_ASSERT_DBG(this->isReal()); } @@ -588,7 +748,7 @@ public: } template - CommonRealValue& operator=(const CommonRealValue val) noexcept + CommonRealValue operator=(const CommonRealValue val) noexcept { _ThisCommonValue::operator=(val); return *this; @@ -599,12 +759,16 @@ public: return CommonRealValue {*this}; } - CommonRealValue operator=(const Value rawVal) const noexcept + RawValueProxy operator*() const noexcept + { + return RawValueProxy {*this}; + } + + void value(const Value val) const noexcept { static_assert(!std::is_const::value, "Not available with `bt2::ConstRealValue`."); - bt_value_real_set(this->libObjPtr(), rawVal); - return *this; + bt_value_real_set(this->libObjPtr(), val); } Value value() const noexcept @@ -612,11 +776,6 @@ public: return bt_value_real_get(this->libObjPtr()); } - operator Value() const noexcept - { - return this->value(); - } - Shared shared() const noexcept { return Shared::createWithRef(*this); @@ -650,18 +809,19 @@ template class CommonStringValue final : public CommonValue { private: - using typename CommonValue::_LibObjPtr; using typename CommonValue::_ThisCommonValue; public: + using typename CommonValue::LibObjPtr; using Shared = SharedValue, LibObjT>; + using Value = bt2c::CStringView; - explicit CommonStringValue(const _LibObjPtr libObjPtr) noexcept : _ThisCommonValue {libObjPtr} + explicit CommonStringValue(const LibObjPtr libObjPtr) noexcept : _ThisCommonValue {libObjPtr} { BT_ASSERT_DBG(this->isString()); } - static Shared create(const char * const rawVal = "") + static Shared create(const bt2c::CStringView rawVal = "") { const auto libObjPtr = bt_value_string_create_init(rawVal); @@ -669,18 +829,13 @@ public: return CommonStringValue::Shared::createWithoutRef(libObjPtr); } - static Shared create(const std::string& rawVal) - { - return CommonStringValue::create(rawVal.data()); - } - template CommonStringValue(const CommonStringValue val) noexcept : _ThisCommonValue {val} { } template - CommonStringValue& operator=(const CommonStringValue val) noexcept + CommonStringValue operator=(const CommonStringValue val) noexcept { _ThisCommonValue::operator=(val); return *this; @@ -691,26 +846,24 @@ public: return CommonStringValue {*this}; } - CommonStringValue operator=(const char * const rawVal) const + RawValueProxy operator*() const noexcept + { + return RawValueProxy {*this}; + } + + void value(const Value val) const { static_assert(!std::is_const::value, "Not available with `bt2::ConstStringValue`."); - const auto status = bt_value_string_set(this->libObjPtr(), rawVal); + const auto status = bt_value_string_set(this->libObjPtr(), *val); if (status == BT_VALUE_STRING_SET_STATUS_MEMORY_ERROR) { throw MemoryError {}; } - - return *this; } - CommonStringValue operator=(const std::string& rawVal) const noexcept - { - return *this = rawVal.data(); - } - - bpstd::string_view value() const noexcept + Value value() const noexcept { return bt_value_string_get(this->libObjPtr()); } @@ -772,14 +925,14 @@ template class CommonArrayValue final : public CommonValue { private: - using typename CommonValue::_LibObjPtr; using typename CommonValue::_ThisCommonValue; public: + using typename CommonValue::LibObjPtr; using Shared = SharedValue, LibObjT>; using Iterator = BorrowedObjectIterator>; - explicit CommonArrayValue(const _LibObjPtr libObjPtr) noexcept : _ThisCommonValue {libObjPtr} + explicit CommonArrayValue(const LibObjPtr libObjPtr) noexcept : _ThisCommonValue {libObjPtr} { BT_ASSERT_DBG(this->isArray()); } @@ -798,7 +951,7 @@ public: } template - CommonArrayValue& operator=(const CommonArrayValue val) noexcept + CommonArrayValue operator=(const CommonArrayValue val) noexcept { _ThisCommonValue::operator=(val); return *this; @@ -891,7 +1044,7 @@ public: this->_handleAppendLibStatus(status); } - void append(const std::string& rawVal) const + void append(const bt2c::CStringView rawVal) const { this->append(rawVal.data()); } @@ -929,7 +1082,7 @@ public: this->append(rawVal); } - void operator+=(const std::string& rawVal) const + void operator+=(const bt2c::CStringView rawVal) const { this->append(rawVal); } @@ -975,7 +1128,7 @@ struct TypeDescr : public ArrayValueTypeDescr * First argument is the entry's key, second is its value. */ template -using CommonMapValueForEachUserFunc = std::function; +using CommonMapValueForEachUserFunc = std::function; /* * Template of a function to be passed to bt_value_map_foreach_entry() @@ -985,7 +1138,7 @@ using CommonMapValueForEachUserFunc = std::function` (the user function to call). * * This function catches any exception which the user function throws - * and returns the `ErrorStatus` value. If there's no execption, this + * and returns the `ErrorStatus` value. If there's no exception, this * function returns the `OkStatus` value. */ template @@ -1076,13 +1229,13 @@ template class CommonMapValue final : public CommonValue { private: - using typename CommonValue::_LibObjPtr; using typename CommonValue::_ThisCommonValue; public: + using typename CommonValue::LibObjPtr; using Shared = SharedValue, LibObjT>; - explicit CommonMapValue(const _LibObjPtr libObjPtr) noexcept : _ThisCommonValue {libObjPtr} + explicit CommonMapValue(const LibObjPtr libObjPtr) noexcept : _ThisCommonValue {libObjPtr} { BT_ASSERT_DBG(this->isMap()); } @@ -1101,7 +1254,7 @@ public: } template - CommonMapValue& operator=(const CommonMapValue val) noexcept + CommonMapValue operator=(const CommonMapValue val) noexcept { _ThisCommonValue::operator=(val); return *this; @@ -1122,34 +1275,18 @@ public: return this->length() == 0; } - nonstd::optional> operator[](const char * const key) const noexcept + OptionalBorrowedObject> + operator[](const bt2c::CStringView key) const noexcept { - const auto libObjPtr = - internal::CommonMapValueSpec::entryByKey(this->libObjPtr(), key); - - if (!libObjPtr) { - return nonstd::nullopt; - } - - return CommonValue {libObjPtr}; + return internal::CommonMapValueSpec::entryByKey(this->libObjPtr(), key); } - nonstd::optional> operator[](const std::string& key) const noexcept - { - return (*this)[key.data()]; - } - - bool hasEntry(const char * const key) const noexcept + bool hasEntry(const bt2c::CStringView key) const noexcept { return static_cast(bt_value_map_has_entry(this->libObjPtr(), key)); } - bool hasEntry(const std::string& key) const noexcept - { - return this->hasEntry(key.data()); - } - - void insert(const char * const key, const Value val) const + void insert(const bt2c::CStringView key, const Value val) const { static_assert(!std::is_const::value, "Not available with `bt2::ConstMapValue`."); @@ -1158,12 +1295,7 @@ public: this->_handleInsertLibStatus(status); } - void insert(const std::string& key, const Value val) const - { - this->insert(key.data(), val); - } - - void insert(const char * const key, const bool rawVal) const + void insert(const bt2c::CStringView key, const bool rawVal) const { static_assert(!std::is_const::value, "Not available with `bt2::ConstMapValue`."); @@ -1173,12 +1305,7 @@ public: this->_handleInsertLibStatus(status); } - void insert(const std::string& key, const bool rawVal) const - { - this->insert(key.data(), rawVal); - } - - void insert(const char * const key, const std::uint64_t rawVal) const + void insert(const bt2c::CStringView key, const std::uint64_t rawVal) const { static_assert(!std::is_const::value, "Not available with `bt2::ConstMapValue`."); @@ -1187,13 +1314,7 @@ public: this->_handleInsertLibStatus(status); } - - void insert(const std::string& key, const std::uint64_t rawVal) const - { - this->insert(key.data(), rawVal); - } - - void insert(const char * const key, const std::int64_t rawVal) const + void insert(const bt2c::CStringView key, const std::int64_t rawVal) const { static_assert(!std::is_const::value, "Not available with `bt2::ConstMapValue`."); @@ -1203,12 +1324,7 @@ public: this->_handleInsertLibStatus(status); } - void insert(const std::string& key, const std::int64_t rawVal) const - { - this->insert(key.data(), rawVal); - } - - void insert(const char * const key, const double rawVal) const + void insert(const bt2c::CStringView key, const double rawVal) const { static_assert(!std::is_const::value, "Not available with `bt2::ConstMapValue`."); @@ -1217,12 +1333,7 @@ public: this->_handleInsertLibStatus(status); } - void insert(const std::string& key, const double rawVal) const - { - this->insert(key.data(), rawVal); - } - - void insert(const char * const key, const char * const rawVal) const + void insert(const bt2c::CStringView key, const char *rawVal) const { static_assert(!std::is_const::value, "Not available with `bt2::ConstMapValue`."); @@ -1231,25 +1342,13 @@ public: this->_handleInsertLibStatus(status); } - void insert(const char * const key, const std::string& rawVal) const - { - this->insert(key, rawVal.data()); - } - - void insert(const std::string& key, const char * const rawVal) const - { - this->insert(key.data(), rawVal); - } - - void insert(const std::string& key, const std::string& rawVal) const + void insert(const bt2c::CStringView key, const bt2c::CStringView rawVal) const { - this->insert(key.data(), rawVal.data()); + return this->insert(key, rawVal.data()); } - CommonArrayValue insertEmptyArray(const char *key) const; - CommonArrayValue insertEmptyArray(const std::string& key) const; - CommonMapValue insertEmptyMap(const char *key) const; - CommonMapValue insertEmptyMap(const std::string& key) const; + CommonArrayValue insertEmptyArray(bt2c::CStringView key) const; + CommonMapValue insertEmptyMap(bt2c::CStringView key) const; void forEach(const internal::CommonMapValueForEachUserFunc>& func) const { @@ -1293,59 +1392,76 @@ struct TypeDescr : public MapValueTypeDescr } /* namespace internal */ +template +ArrayValue CommonValue::appendEmptyArray() const +{ + return this->asArray().appendEmptyArray(); +} + +template +MapValue CommonValue::appendEmptyMap() const +{ + return this->asArray().appendEmptyMap(); +} + +template +ArrayValue CommonValue::insertEmptyArray(const bt2c::CStringView key) const +{ + return this->asMap().insertEmptyArray(key); +} + +template +MapValue CommonValue::insertEmptyMap(const bt2c::CStringView key) const +{ + return this->asMap().insertEmptyMap(key); +} + template CommonNullValue CommonValue::asNull() const noexcept { BT_ASSERT_DBG(this->isNull()); - return CommonNullValue {this->libObjPtr()}; + return CommonNullValue {}; } template CommonBoolValue CommonValue::asBool() const noexcept { - BT_ASSERT_DBG(this->isBool()); return CommonBoolValue {this->libObjPtr()}; } template CommonSignedIntegerValue CommonValue::asSignedInteger() const noexcept { - BT_ASSERT_DBG(this->isSignedInteger()); return CommonSignedIntegerValue {this->libObjPtr()}; } template CommonUnsignedIntegerValue CommonValue::asUnsignedInteger() const noexcept { - BT_ASSERT_DBG(this->isUnsignedInteger()); return CommonUnsignedIntegerValue {this->libObjPtr()}; } template CommonRealValue CommonValue::asReal() const noexcept { - BT_ASSERT_DBG(this->isReal()); return CommonRealValue {this->libObjPtr()}; } template CommonStringValue CommonValue::asString() const noexcept { - BT_ASSERT_DBG(this->isString()); return CommonStringValue {this->libObjPtr()}; } template CommonArrayValue CommonValue::asArray() const noexcept { - BT_ASSERT_DBG(this->isArray()); return CommonArrayValue {this->libObjPtr()}; } template CommonMapValue CommonValue::asMap() const noexcept { - BT_ASSERT_DBG(this->isMap()); return CommonMapValue {this->libObjPtr()}; } @@ -1374,7 +1490,7 @@ MapValue CommonArrayValue::appendEmptyMap() const } template -ArrayValue CommonMapValue::insertEmptyArray(const char * const key) const +ArrayValue CommonMapValue::insertEmptyArray(const bt2c::CStringView key) const { static_assert(!std::is_const::value, "Not available with `bt2::ConstMapValue`."); @@ -1386,13 +1502,7 @@ ArrayValue CommonMapValue::insertEmptyArray(const char * const key) con } template -ArrayValue CommonMapValue::insertEmptyArray(const std::string& key) const -{ - return this->insertEmptyArray(key.data()); -} - -template -MapValue CommonMapValue::insertEmptyMap(const char * const key) const +MapValue CommonMapValue::insertEmptyMap(const bt2c::CStringView key) const { static_assert(!std::is_const::value, "Not available with `bt2::ConstMapValue`."); @@ -1403,12 +1513,6 @@ MapValue CommonMapValue::insertEmptyMap(const char * const key) const return MapValue {libEntryPtr}; } -template -MapValue CommonMapValue::insertEmptyMap(const std::string& key) const -{ - return this->insertEmptyMap(key.data()); -} - inline BoolValue::Shared createValue(const bool rawVal) { return BoolValue::create(rawVal); @@ -1434,7 +1538,7 @@ inline StringValue::Shared createValue(const char * const rawVal) return StringValue::create(rawVal); } -inline StringValue::Shared createValue(const std::string& rawVal) +inline StringValue::Shared createValue(const bt2c::CStringView rawVal) { return StringValue::create(rawVal); }