userver: proto_structs::io::ContextWithErrors< TError > Class Template Reference
Loading...
Searching...
No Matches
proto_structs::io::ContextWithErrors< TError > Class Template Reference

#include </data/code/userver/libraries/proto-structs/include/userver/proto-structs/io/context_base.hpp>

Detailed Description

template<typename TError>
class proto_structs::io::ContextWithErrors< TError >

Read/write operation context with error information.

Template Parameters
TErrorerror type

Definition at line 48 of file context_base.hpp.

+ Inheritance diagram for proto_structs::io::ContextWithErrors< TError >:

Public Types

using Error = TError
 

Public Member Functions

bool HasErrors () const noexcept
 Returns true if context contains at least one error.
 
void AddError (int field_number, std::string_view reason)
 Adds conversion error.
 
void AddError (const ::google::protobuf::FieldDescriptor &field_desc, std::string_view reason)
 Adds conversion error Parameter field_desc contains protobuf message field descriptor for which conversion has failed.
 
void AddError (std::string_view reason)
 Adds conversion error Method is intended for cases when it is hard to associate error with concrete field of the protobuf message.
 

Protected Member Functions

 Context (const ::google::protobuf::Descriptor &message_desc) noexcept
 
std::string GetCurrentPath (int current_field_number) const
 
std::string GetCurrentPath (const ::google::protobuf::FieldDescriptor &current_field_desc) const
 
std::string GetCurrentPath () const
 
void PopFromPath ()
 
void PushToPath (int field_number)
 

Member Typedef Documentation

◆ Error

template<typename TError>
using proto_structs::io::ContextWithErrors< TError >::Error = TError

Definition at line 50 of file context_base.hpp.

Member Function Documentation

◆ AddError() [1/3]

template<typename TError>
void proto_structs::io::ContextWithErrors< TError >::AddError ( const ::google::protobuf::FieldDescriptor & field_desc,
std::string_view reason )

Adds conversion error Parameter field_desc contains protobuf message field descriptor for which conversion has failed.

Definition at line 87 of file context_base.cpp.

◆ AddError() [2/3]

template<typename TError>
void proto_structs::io::ContextWithErrors< TError >::AddError ( int field_number,
std::string_view reason )

Adds conversion error.

Exceptions
Errorexception Parameter field_number contains protobuf message field number for which conversion has failed.

Definition at line 82 of file context_base.cpp.

◆ AddError() [3/3]

template<typename TError>
void proto_structs::io::ContextWithErrors< TError >::AddError ( std::string_view reason)

Adds conversion error Method is intended for cases when it is hard to associate error with concrete field of the protobuf message.

Definition at line 95 of file context_base.cpp.

◆ Context()

template<typename TError>
proto_structs::io::Context::Context ( const ::google::protobuf::Descriptor & message_desc)
inlineexplicitprotectednoexcept

Definition at line 29 of file context_base.hpp.

◆ GetCurrentPath() [1/3]

template<typename TError>
std::string proto_structs::io::Context::GetCurrentPath ( ) const
protected

Definition at line 36 of file context_base.cpp.

◆ GetCurrentPath() [2/3]

template<typename TError>
std::string proto_structs::io::Context::GetCurrentPath ( const ::google::protobuf::FieldDescriptor & current_field_desc) const
protected

Definition at line 35 of file context_base.cpp.

◆ GetCurrentPath() [3/3]

template<typename TError>
std::string proto_structs::io::Context::GetCurrentPath ( int current_field_number) const
protected

Definition at line 34 of file context_base.cpp.

◆ HasErrors()

template<typename TError>
bool proto_structs::io::ContextWithErrors< TError >::HasErrors ( ) const
inlinenoexcept

Returns true if context contains at least one error.

Definition at line 53 of file context_base.hpp.

◆ PopFromPath()

template<typename TError>
void proto_structs::io::Context::PopFromPath ( )
inlineprotected

Definition at line 32 of file context_base.hpp.

◆ PushToPath()

template<typename TError>
void proto_structs::io::Context::PushToPath ( int field_number)
inlineprotected

Definition at line 31 of file context_base.hpp.


The documentation for this class was generated from the following files: