2 * Copyright (c) 2023 Philippe Proulx <pproulx@efficios.com>
4 * SPDX-License-Identifier: MIT
7 #ifndef BABELTRACE_CPP_COMMON_BT2_RAW_VALUE_PROXY_HPP
8 #define BABELTRACE_CPP_COMMON_BT2_RAW_VALUE_PROXY_HPP
12 #include "cpp-common/bt2c/c-string-view.hpp"
16 template <typename ObjT>
20 using _RawVal = typename ObjT::Value;
23 explicit RawValueProxy(const ObjT obj) : _mObj {obj}
27 RawValueProxy& operator=(const _RawVal& rawVal)
33 operator _RawVal() const noexcept
42 template <typename ObjT>
43 class RawStringValueProxy final : public RawValueProxy<ObjT>
46 explicit RawStringValueProxy(const ObjT obj) : RawValueProxy<ObjT> {obj}
50 RawStringValueProxy& operator=(const char * const rawVal)
52 RawValueProxy<ObjT>::operator=(bt2c::CStringView {rawVal});
56 RawStringValueProxy& operator=(const std::string& rawVal)
58 RawValueProxy<ObjT>::operator=(bt2c::CStringView {rawVal.data()});
65 #endif /* BABELTRACE_CPP_COMMON_BT2_RAW_VALUE_PROXY_HPP */