27#ifndef SDBUS_CXX_TYPES_H_
28#define SDBUS_CXX_TYPES_H_
58 template <
typename _ValueType>
59 Variant(
const _ValueType& value)
68 template <
typename... _Elements>
69 Variant(
const std::variant<_Elements...>& value)
76 template <
typename _ValueType>
77 _ValueType get()
const
88 template <typename _ValueType, typename = std::enable_if_t<signature_of<_ValueType>::is_valid>>
89 operator _ValueType()
const
91 return get<_ValueType>();
94 template <
typename... _Elements>
95 operator std::variant<_Elements...>()
const
97 std::variant<_Elements...> result;
103 template <
typename _Type>
104 bool containsValueOfType()
const
109 bool isEmpty()
const;
111 void serializeTo(
Message& msg)
const;
112 void deserializeFrom(
Message& msg);
113 std::string peekValueType()
const;
129 template <
typename... _ValueTypes>
131 :
public std::tuple<_ValueTypes...>
134 using std::tuple<_ValueTypes...>::tuple;
137#if !((defined(__GNUC__) || defined(__GNUG__)) && !defined(__clang__) && !(__GNUC__ > 7 || (__GNUC__ == 7 && (__GNUC_MINOR__ > 1 || (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ > 0)))))
140 explicit Struct(
const std::tuple<_ValueTypes...>& t)
141 : std::tuple<_ValueTypes...>(t)
146 template <std::
size_t _I>
149 return std::get<_I>(*
this);
152 template <std::
size_t _I>
153 const auto& get()
const
155 return std::get<_I>(*
this);
159 template <
typename... _Elements>
162 template<
typename... _Elements>
163 constexpr Struct<std::decay_t<_Elements>...>
164 make_struct(_Elements&&... args)
166 typedef Struct<std::decay_t<_Elements>...> result_type;
167 return result_type(std::forward<_Elements>(args)...);
179 using std::string::string;
186 : std::string(std::move(path))
188 using std::string::operator=;
200 using std::string::string;
207 : std::string(std::move(path))
209 using std::string::operator=;
229 : fd_(checkedDup(fd))
250 fd_ = checkedDup(other.fd_);
256 *
this = std::move(other);
266 fd_ = std::exchange(other.fd_, -1);
280 void reset(
int fd = -1)
287 *
this =
UnixFd{fd, adopt_fd};
292 return std::exchange(fd_, -1);
306 static int checkedDup(
int fd);
313template <
size_t _I,
typename... _ValueTypes>
314struct std::tuple_element<_I, sdbus::Struct<_ValueTypes...>>
315 : std::tuple_element<_I, std::tuple<_ValueTypes...>>
318template <
typename... _ValueTypes>
319struct std::tuple_size<sdbus::Struct<_ValueTypes...>>
320 : std::tuple_size<std::tuple<_ValueTypes...>>
Definition TypeTraits.h:88
Definition TypeTraits.h:107