Qpid Proton C++ API  0.17.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
decoder Class Reference

Experimental - 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. More...
 
void decode (const std::string &)
 Decode AMQP data from a std::string and add it to the end of the decoders stream. More...
 
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. More...
 
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. More...
 
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 &)
 

Friends

class message
 

Detailed Description

Experimental - Stream-like decoder from AMQP bytes to C++ values.

For internal use only.

See Also
types_page for the recommended ways to manage AMQP data

Constructor & Destructor Documentation

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 ( 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

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.

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().
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.

decoder& operator>> ( const finish )

Finish decoding a container type, and move on to the next value in the stream.

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...].

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

Extract an AMQP MAP to a C++ push_back sequence of pairs preserving encoded order.


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