#include </data/code/userver/libraries/proto-structs/include/userver/proto-structs/any.hpp>
Wrapper for google.protobuf.Any
which provides interface to access stored message as compatible struct.
Definition at line 19 of file any.hpp.
|
| Any () noexcept=default |
| Creates empty Any .
|
|
| Any (google::protobuf::Any proto_any) |
| Creates wrapper initializing its underlying storage with proto_any.
|
|
template<typename TStruct>
requires (!std::is_same_v<std::remove_cvref_t<TStruct>, ::google::protobuf::Any>) && (!std::is_same_v<std::remove_cvref_t<TStruct>, Any>) && traits::ProtoStruct<std::remove_cvref_t<TStruct>> |
| Any (TStruct &&obj) |
| Creates Any holding obj.
|
|
template<typename TStruct>
requires (!std::is_same_v<std::remove_cvref_t<TStruct>, ::google::protobuf::Any>) && (!std::is_same_v<std::remove_cvref_t<TStruct>, Any>) && traits::ProtoStruct<std::remove_cvref_t<TStruct>> |
Any & | operator= (TStruct &&obj) |
| Packs obj in Any .
|
|
template<traits::ProtoStruct TStruct> |
bool | Is () const noexcept |
| Returns true if Any contains TStruct .
|
|
template<traits::ProtoMessage TMessage> |
bool | Is () const noexcept |
| Returns true if underlying google.protobuf.Any contains TMessage .
|
|
template<traits::ProtoStruct TStruct> |
TStruct | Unpack () |
| Unpacks Any to TStruct struct.
|
|
template<traits::ProtoMessage TMessage> |
TMessage | Unpack () |
| Unpacks underlying google.protobuf.Any to TMessage message.
|
|
template<typename TStruct>
requires traits::ProtoStruct<std::remove_cvref_t<TStruct>> |
void | Pack (TStruct &&obj) |
| Packs obj to Any .
|
|
template<traits::ProtoMessage TMessage> |
void | Pack (const TMessage &message) |
| Packs message to underlying google.protobuf.Any .
|
|
const ::google::protobuf::Any & | GetProtobufAny () const &noexcept |
| Returns underlying google.protobuf.Any .
|
|
::google::protobuf::Any && | GetProtobufAny () &&noexcept |
| Returns underlying google.protobuf.Any .
|
|
◆ ProtobufMessage
using proto_structs::Any::ProtobufMessage = ::google::protobuf::Any |
◆ Any() [1/2]
proto_structs::Any::Any |
( |
google::protobuf::Any | proto_any | ) |
|
|
inline |
Creates wrapper initializing its underlying storage with proto_any.
Definition at line 27 of file any.hpp.
◆ Any() [2/2]
template<typename TStruct>
requires (!std::is_same_v<std::remove_cvref_t<TStruct>, ::google::protobuf::Any>) && (!std::is_same_v<std::remove_cvref_t<TStruct>,
Any>) && traits::ProtoStruct<std::remove_cvref_t<TStruct>>
proto_structs::Any::Any |
( |
TStruct && | obj | ) |
|
|
inline |
Creates Any
holding obj.
- Template Parameters
-
- Exceptions
-
WriteError | if conversion of obj to its compatible message has failed. |
AnyPackError | if compatible protobuf message can not be packed to google.protobuf.Any . |
Definition at line 36 of file any.hpp.
◆ GetProtobufAny() [1/2]
::google::protobuf::Any && proto_structs::Any::GetProtobufAny |
( |
| ) |
&& |
|
inlinenodiscardnoexcept |
Returns underlying google.protobuf.Any
.
Definition at line 116 of file any.hpp.
◆ GetProtobufAny() [2/2]
const ::google::protobuf::Any & proto_structs::Any::GetProtobufAny |
( |
| ) |
const & |
|
inlinenodiscardnoexcept |
Returns underlying google.protobuf.Any
.
Definition at line 113 of file any.hpp.
◆ Is() [1/2]
template<traits::ProtoStruct TStruct>
bool proto_structs::Any::Is |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
Returns true
if Any
contains TStruct
.
- Template Parameters
-
Definition at line 55 of file any.hpp.
◆ Is() [2/2]
template<traits::ProtoMessage TMessage>
bool proto_structs::Any::Is |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
Returns true
if underlying google.protobuf.Any
contains TMessage
.
- Template Parameters
-
TMessage | protobuf message type |
Definition at line 63 of file any.hpp.
◆ operator=()
template<typename TStruct>
requires (!std::is_same_v<std::remove_cvref_t<TStruct>, ::google::protobuf::Any>) && (!std::is_same_v<std::remove_cvref_t<TStruct>,
Any>) && traits::ProtoStruct<std::remove_cvref_t<TStruct>>
Any & proto_structs::Any::operator= |
( |
TStruct && | obj | ) |
|
|
inline |
Packs obj in Any
.
- Template Parameters
-
- Exceptions
-
WriteError | if conversion of obj to its compatible message has failed. |
AnyPackError | if compatible protobuf message can not be packed to google.protobuf.Any . |
Definition at line 47 of file any.hpp.
◆ Pack() [1/2]
template<traits::ProtoMessage TMessage>
void proto_structs::Any::Pack |
( |
const TMessage & | message | ) |
|
|
inline |
Packs message to underlying google.protobuf.Any
.
- Template Parameters
-
TMessage | protobuf message type |
- Exceptions
-
AnyPackError | if packing of protobuf message to google.protobuf.Any has failed. |
Definition at line 106 of file any.hpp.
◆ Pack() [2/2]
template<typename TStruct>
requires traits::ProtoStruct<std::remove_cvref_t<TStruct>>
void proto_structs::Any::Pack |
( |
TStruct && | obj | ) |
|
|
inline |
Packs obj to Any
.
- Template Parameters
-
- Exceptions
-
WriteError | if conversion of obj to its compatible message has failed. |
AnyPackError | if packing of compatible protobuf message to google.protobuf.Any has failed. |
Definition at line 97 of file any.hpp.
◆ Unpack() [1/2]
template<traits::ProtoStruct TStruct>
TStruct proto_structs::Any::Unpack |
( |
| ) |
|
|
inlinenodiscard |
Unpacks Any
to TStruct
struct.
- Template Parameters
-
- Exceptions
-
AnyUnpackError | if underlying google.protobuf.Any does not contain message compatible to TStruct . |
ReadError | if conversion of unpacked protobuf message to proto struct has failed. |
Definition at line 72 of file any.hpp.
◆ Unpack() [2/2]
template<traits::ProtoMessage TMessage>
TMessage proto_structs::Any::Unpack |
( |
| ) |
|
|
inlinenodiscard |
Unpacks underlying google.protobuf.Any
to TMessage
message.
- Template Parameters
-
TMessage | protobuf message type |
- Exceptions
-
AnyUnpackError | if underlying google.protobuf.Any does not contain TMessage type message. |
Definition at line 81 of file any.hpp.
The documentation for this class was generated from the following file:
- /data/code/userver/libraries/proto-structs/include/userver/proto-structs/any.hpp