Qpid Proton C++ API  0.37.0
decoder

Unsettled API - A stream-like decoder from AMQP bytes to C++ values. More...

#include <decoder.hpp>

Inherits data.

Public Member Functions

 decoder (const data &d, bool exact=false)
 Wrap a Proton C data object. More...
 
 decoder (const internal::value_base &, bool exact=false)
 Attach decoder to a proton::value. More...
 
void decode (const char *buffer, size_t size)
 Decode AMQP data from a buffer and add it to the end of the decoders stream.
 
void decode (const std::string &)
 Decode AMQP data from a std::string and add it to the end of the decoders stream.
 
bool more ()
 Return true if there are more value to extract at the current level.
 
type_id next_type ()
 Get the type of the next value that will be read by operator>>. More...
 
decoderoperator>> (start &)
 Start decoding a container type, such as an ARRAY, LIST or MAP. More...
 
decoderoperator>> (const finish &)
 Finish decoding a container type, and move on to the next value in the stream.
 
template<class T >
decoderoperator>> (sequence_ref< T > r)
 Extract any AMQP sequence (ARRAY, LIST or MAP) to a C++ sequence container of T if the elements types are convertible to T. More...
 
template<class T >
decoderoperator>> (associative_ref< T > r)
 Extract an AMQP MAP to a C++ associative container.
 
template<class T >
decoderoperator>> (pair_sequence_ref< T > r)
 Extract an AMQP MAP to a C++ push_back sequence of pairs preserving encoded order.
 
Extract built-in types
Exceptions
conversion_errorif the decoder is empty or has an incompatible type.
decoderoperator>> (bool &)
 
decoderoperator>> (uint8_t &)
 
decoderoperator>> (int8_t &)
 
decoderoperator>> (uint16_t &)
 
decoderoperator>> (int16_t &)
 
decoderoperator>> (uint32_t &)
 
decoderoperator>> (int32_t &)
 
decoderoperator>> (wchar_t &)
 
decoderoperator>> (uint64_t &)
 
decoderoperator>> (int64_t &)
 
decoderoperator>> (timestamp &)
 
decoderoperator>> (float &)
 
decoderoperator>> (double &)
 
decoderoperator>> (decimal32 &)
 
decoderoperator>> (decimal64 &)
 
decoderoperator>> (decimal128 &)
 
decoderoperator>> (uuid &)
 
decoderoperator>> (std::string &)
 
decoderoperator>> (symbol &)
 
decoderoperator>> (binary &)
 
decoderoperator>> (message_id &)
 
decoderoperator>> (annotation_key &)
 
decoderoperator>> (scalar &)
 
decoderoperator>> (internal::value_base &)
 
decoderoperator>> (null &)
 
decoderoperator>> (decltype(nullptr)&)
 

Friends

class message
 

Detailed Description

Unsettled API - A stream-like decoder from AMQP bytes to C++ values.

For internal use only.

See also
AMQP and C++ types for the recommended ways to manage AMQP data

Constructor & Destructor Documentation

◆ decoder() [1/2]

decoder ( const data &  d,
bool  exact = false 
)
inlineexplicit

Wrap a Proton C data object.

The exact flag if set means decode only when there is an exact match between the AMQP and C++ type. If not set then perform automatic conversions.

◆ decoder() [2/2]

decoder ( const internal::value_base &  ,
bool  exact = false 
)
explicit

Attach decoder to a proton::value.

The decoder is rewound to the start of the data.

Member Function Documentation

◆ next_type()

type_id next_type ( )

Get the type of the next value that will be read by operator>>.

Exceptions
conversion_errorif no more values.
See also
decoder::more().

◆ operator>>() [1/2]

decoder& operator>> ( start )

Start decoding a container type, such as an ARRAY, LIST or MAP.

This "enters" the container, more() will return false at the end of the container. Call finish() to "exit" the container and move on to the next value.

◆ operator>>() [2/2]

decoder& operator>> ( sequence_ref< T >  r)
inline

Extract any AMQP sequence (ARRAY, LIST or MAP) to a C++ sequence container of T if the elements types are convertible to T.

A MAP is extracted as [key1, value1, key2, value2...].


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