cpp-common/bt2: use bt2c::CStringView in parameters and return values throughout
[babeltrace.git] / src / cpp-common / bt2 / raw-value-proxy.hpp
CommitLineData
b3f060ed
PP
1/*
2 * Copyright (c) 2023 Philippe Proulx <pproulx@efficios.com>
3 *
4 * SPDX-License-Identifier: MIT
5 */
6
7#ifndef BABELTRACE_CPP_COMMON_BT2_RAW_VALUE_PROXY_HPP
8#define BABELTRACE_CPP_COMMON_BT2_RAW_VALUE_PROXY_HPP
9
10#include <string>
11
e7f0f07b
SM
12#include "cpp-common/bt2c/c-string-view.hpp"
13
b3f060ed
PP
14namespace bt2 {
15
16template <typename ObjT>
17class RawValueProxy
18{
19private:
20 using _RawVal = typename ObjT::Value;
21
22public:
23 explicit RawValueProxy(const ObjT obj) : _mObj {obj}
24 {
25 }
26
27 RawValueProxy& operator=(const _RawVal& rawVal)
28 {
29 _mObj.value(rawVal);
30 return *this;
31 }
32
33 operator _RawVal() const noexcept
34 {
35 return _mObj.value();
36 }
37
38private:
39 ObjT _mObj;
40};
41
b3f060ed
PP
42} /* namespace bt2 */
43
44#endif /* BABELTRACE_CPP_COMMON_BT2_RAW_VALUE_PROXY_HPP */
This page took 0.025578 seconds and 4 git commands to generate.