decoder Class Reference

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

#include <decoder.hpp>

Inheritance diagram for decoder:

List of all members.

Public Member Functions

 decoder (const data &d, bool exact=false)
 Wrap a Proton C data object.
 decoder (const internal::value_base &, bool exact=false)
 Attach decoder to a proton::value.
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>>.
decoderoperator>> (start &)
 Start decoding a container type, such as an ARRAY, LIST or MAP.
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.
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_error if 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 
) [inline, explicit]

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 std::string &   ) 

Decode AMQP data from a std::string and add it to the end of the decoders stream.

void decode ( const char *  buffer,
size_t  size 
)

Decode AMQP data from a buffer 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_error if no more values.
See also:
decoder::more().
decoder& operator>> ( pair_sequence_ref< T >  r  )  [inline]

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

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>> ( const finish  ) 

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

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.


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

Generated on 27 Jan 2017 for Qpid Proton C++ by  doxygen 1.6.1