Top namespace for the proto-structs library.
Namespaces | |
namespace | io |
Namespace for conversion utlities and predefined proto-structs conversion hooks for well-known std/userver types. | |
namespace | traits |
Namespace contains types for obtaining meta information (traits, concepts, etc.). | |
Classes | |
class | Any |
Wrapper for google.protobuf.Any which provides interface to access stored message as compatible struct. More... | |
class | AnyPackError |
Error packing protobuf message to proto_structs::Any underlying storage. More... | |
class | AnyUnpackError |
Error unpacking protobuf message from proto_structs::Any underlying storage. More... | |
class | ConversionError |
Conversion error base class. More... | |
class | Date |
Type to represent google.type.Date in proto structs. More... | |
class | Duration |
Type to represent google.protobuf.Duration in proto structs. More... | |
class | Error |
Library basic exception type. All other proto-structs exceptions are derived from this type. More... | |
class | Oneof |
Wrapper for oneof protobuf message fields. More... | |
class | OneofAccessError |
Invalid attempt to access unset proto_structs::Oneof field. More... | |
class | ReadError |
Error reading proto struct from protobuf message. More... | |
class | TimeOfDay |
Type to represent google.type.TimeOfDay in proto structs. More... | |
class | Timestamp |
Type to represent google.protobuf.Timestamp in proto structs. More... | |
struct | UnbreakableDependencyCycle |
A type that is generated for a field that participates in an unbreakable dependency cycle. More... | |
class | ValueError |
Incorrect value error. More... | |
class | WriteError |
Error writing proto struct to protobuf message. More... | |
Typedefs | |
template<typename Key, typename Value> | |
using | HashMap |
The hash map container used in userver proto structs by default. | |
template<std::size_t Index, traits::Oneof TOneof> | |
using | OneofAlternativeTrait = impl::OneofAlternativeTrait<Index, typename TOneof::Base> |
Provides information about proto_structs::Oneof field type at position Index . | |
template<std::size_t Index, typename TOneof> | |
using | OneofAlternativeType = OneofAlternativeTrait<Index, TOneof>::Type |
Functions | |
template<traits::ProtoMessage TMessage, traits::ProtoStruct TStruct> | |
void | MessageToStruct (const TMessage &msg, TStruct &obj) |
Converts protobuf message msg to proto struct obj. | |
template<traits::ProtoStruct TStruct, traits::ProtoMessage TMessage> | |
TStruct | MessageToStruct (const TMessage &msg) |
Converts protobuf message msg to specified proto struct type. | |
template<typename TStruct, traits::ProtoMessage TMessage> requires traits::ProtoStruct<std::remove_cvref_t<TStruct>> | |
void | StructToMessage (TStruct &&obj, TMessage &msg) |
Converts proto struct obj to protobuf message msg. | |
template<typename TStruct> requires traits::ProtoStruct<std::remove_cvref_t<TStruct>> | |
traits::CompatibleMessageType< std::remove_cvref_t< TStruct > > | StructToMessage (TStruct &&obj) |
Converts proto struct obj to it's compatible protobuf message type. | |
Variables | |
constexpr std::size_t | kOneofNpos = -1 |
Special index value used to indicate oneof without any field set. | |
using proto_structs::HashMap |
The hash map container used in userver proto structs by default.
Currently implemented as just std::unordered_map
. Please don't assume it! For example:
std::unordered_map
, use proto_structs::HashMap
instead;std::unordered_map
with these fields. Definition at line 23 of file hash_map.hpp.
using proto_structs::OneofAlternativeTrait = impl::OneofAlternativeTrait<Index, typename TOneof::Base> |
Provides information about proto_structs::Oneof field type at position Index
.
Definition at line 133 of file type_mapping.hpp.
using proto_structs::OneofAlternativeType = OneofAlternativeTrait<Index, TOneof>::Type |
Definition at line 136 of file type_mapping.hpp.
|
nodiscard |
Converts protobuf message msg to specified proto struct type.
TStruct | proto struct type |
TMessage | protobuf message type |
ReadError | if conversion has failed. |
Definition at line 56 of file convert.hpp.
void proto_structs::MessageToStruct | ( | const TMessage & | msg, |
TStruct & | obj ) |
Converts protobuf message msg to proto struct obj.
TMessage | protobuf message type |
TStruct | proto struct type |
ReadError | if conversion has failed. |
Definition at line 36 of file convert.hpp.
|
nodiscard |
Converts proto struct obj to it's compatible protobuf message type.
TStruct | proto struct type |
WriteError | if conversion has failed. |
Definition at line 89 of file convert.hpp.
void proto_structs::StructToMessage | ( | TStruct && | obj, |
TMessage & | msg ) |
Converts proto struct obj to protobuf message msg.
TStruct | proto struct type |
TMessage | protobuf message type |
WriteError | if conversion has failed. |
Definition at line 69 of file convert.hpp.
|
inlineconstexpr |
Special index value used to indicate oneof
without any field set.
Definition at line 129 of file type_mapping.hpp.