MySQL 9.1.0
Source Code Documentation
classic_protocol::impl::DecodeBufferAccumulator Class Reference

Generator of decoded Types of a buffer. More...

#include <classic_protocol_codec_base.h>

Public Types

using buffer_type = net::const_buffer
 
using result_type = stdx::expected< size_t, std::error_code >
 

Public Member Functions

 DecodeBufferAccumulator (const net::const_buffer &buffer, capabilities::value_type caps, size_t consumed=0)
 construct a DecodeBufferAccumulator. More...
 
template<class T >
stdx::expected< typename Codec< T >::value_type, std::error_code > step (size_t sz=std::numeric_limits< size_t >::max())
 decode a Type from the buffer sequence. More...
 
template<class T >
stdx::expected< typename Codec< T >::value_type, std::error_code > try_step (size_t sz=std::numeric_limits< size_t >::max())
 try decoding a Type from the buffer sequence. More...
 
result_type result () const
 get result of the step(). More...
 

Private Member Functions

template<class T >
stdx::expected< typename Codec< T >::value_type, std::error_code > step_ (size_t sz)
 

Private Attributes

net::const_buffer buffer_
 
const capabilities::value_type caps_
 
size_t consumed_
 
result_type res_
 

Detailed Description

Generator of decoded Types of a buffer.

  • .step<wire::VarInt>()

Member Typedef Documentation

◆ buffer_type

◆ result_type

Constructor & Destructor Documentation

◆ DecodeBufferAccumulator()

classic_protocol::impl::DecodeBufferAccumulator::DecodeBufferAccumulator ( const net::const_buffer buffer,
capabilities::value_type  caps,
size_t  consumed = 0 
)
inline

construct a DecodeBufferAccumulator.

Parameters
buffera net::const_buffer
capsclassic-protocol capabilities
consumedbytes to skip from the buffers

Member Function Documentation

◆ result()

result_type classic_protocol::impl::DecodeBufferAccumulator::result ( ) const
inline

get result of the step().

if a step() failed, result is the error-code of the first failed step()

Returns
consumed bytes by all steps(), or error of first failed step()

◆ step()

template<class T >
stdx::expected< typename Codec< T >::value_type, std::error_code > classic_protocol::impl::DecodeBufferAccumulator::step ( size_t  sz = std::numeric_limits<size_t>::max())
inline

decode a Type from the buffer sequence.

if it succeeds, moves position in buffer forward and returns decoded Type, otherwise returns error and updates the global error-code in result()

'sz' is unlimited, the whole rest of the current buffer is passed to the decoder.

If not, a slice of size 'sz' is taken. If there isn't at least 'sz' bytes in the buffer, it fails.

Parameters
szlimits the size of the current buffer.

◆ step_()

template<class T >
stdx::expected< typename Codec< T >::value_type, std::error_code > classic_protocol::impl::DecodeBufferAccumulator::step_ ( size_t  sz)
inlineprivate

◆ try_step()

template<class T >
stdx::expected< typename Codec< T >::value_type, std::error_code > classic_protocol::impl::DecodeBufferAccumulator::try_step ( size_t  sz = std::numeric_limits<size_t>::max())
inline

try decoding a Type from the buffer sequence.

if it succeeds, moves position in buffer-sequence forward and returns decoded Type, otherwise returns error and does NOT update the global error-code in result()

Member Data Documentation

◆ buffer_

net::const_buffer classic_protocol::impl::DecodeBufferAccumulator::buffer_
private

◆ caps_

const capabilities::value_type classic_protocol::impl::DecodeBufferAccumulator::caps_
private

◆ consumed_

size_t classic_protocol::impl::DecodeBufferAccumulator::consumed_
private

◆ res_

result_type classic_protocol::impl::DecodeBufferAccumulator::res_
private

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