template<traits::OneofField... TFields>
class proto_structs::Oneof< TFields >
Wrapper for oneof
protobuf message fields.
- Template Parameters
-
Definition at line 69 of file oneof.hpp.
|
constexpr | Oneof ()=default |
| Creates oneof without any field set.
|
|
template<std::size_t Index, typename... TArgs> |
constexpr | Oneof (std::in_place_index_t< Index > index, TArgs &&... args) |
| Creates oneof wrapper initializing index field.
|
|
constexpr std::size_t | GetIndex () const noexcept |
| Returns zero-based index of the alternative held by the oneof. If oneof does not contain any field, returns proto_structs::kOneofNpos .
|
|
constexpr bool | Contains (std::size_t index) const noexcept |
| Returns true of oneof contains index field.
|
|
constexpr bool | ContainsAny () const noexcept |
| Returns true of oneof contains some field.
|
|
template<std::size_t Index> |
constexpr const OneofAlternativeType< Index, Oneof< TFields... > > & | Get () const & |
| Returns Index field.
|
|
template<std::size_t Index> |
constexpr OneofAlternativeType< Index, Oneof< TFields... > > & | Get () & |
| Returns Index field.
|
|
template<std::size_t Index> |
constexpr OneofAlternativeType< Index, Oneof< TFields... > > && | Get () && |
| Returns Index field.
|
|
template<std::size_t Index, typename... TArgs> |
constexpr OneofAlternativeType< Index, Oneof< TFields... > > & | Emplace (TArgs &&... args) |
| Initializes Index field in-place and returns it.
|
|
template<std::size_t Index> |
constexpr void | Set (const OneofAlternativeType< Index, Oneof< TFields... > > &value) |
|
template<std::size_t Index> |
constexpr void | Set (OneofAlternativeType< Index, Oneof< TFields... > > &&value) |
|
void | Clear (std::size_t index) noexcept |
| Clear field Index if it is set.
|
|
void | ClearOneof () noexcept |
| Clears oneof.
|
|
constexpr | operator bool () const noexcept |
| Returns true if oneof contains some field.
|
|