decoder

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...
decoder & | operator>> (start &)
| Start decoding a container type, such as an ARRAY, LIST or MAP. More...
decoder & | operator>> (const finish &)
| Finish decoding a container type, and move on to the next value in the stream. More...
template<class T >
decoder & | operator>> (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 >
decoder & | operator>> (associative_ref< T > r)
| Extract an AMQP MAP to a C++ associative container.
template<class T >
decoder & | operator>> (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_error | if the decoder is empty or has an incompatible type.

decoder & | operator>> (bool &)
decoder & | operator>> (uint8_t &)
decoder & | operator>> (int8_t &)
decoder & | operator>> (uint16_t &)
decoder & | operator>> (int16_t &)
decoder & | operator>> (uint32_t &)
decoder & | operator>> (int32_t &)
decoder & | operator>> (wchar_t &)
decoder & | operator>> (uint64_t &)
decoder & | operator>> (int64_t &)
decoder & | operator>> (timestamp &)
decoder & | operator>> (float &)
decoder & | operator>> (double &)
decoder & | operator>> (decimal32 &)
decoder & | operator>> (decimal64 &)
decoder & | operator>> (decimal128 &)
decoder & | operator>> (uuid &)
decoder & | operator>> (std::string &)
decoder & | operator>> (symbol &)
decoder & | operator>> (binary &)
decoder & | operator>> (message_id &)
decoder & | operator>> (annotation_key &)
decoder & | operator>> (scalar &)
decoder & | operator>> (internal::value_base &)
decoder & | operator>> (null &)

## Friends

class | message

## Detailed Description

Experimental - 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`
| ) |  |

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

## decode() [1/2]

void decode | ( | const char * | buffer,
|  | size_t | size
| ) |  |

Decode AMQP data from a buffer and add it to the end of the decoders stream.

## decode() [2/2]

void decode | ( | const std::string & |  | ) |

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

## next_type()

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

## operator>>() [1/4]

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/4]

decoder& operator>> | ( | const finish & |  | ) |

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

## operator>>() [3/4]

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

## operator>>() [4/4]

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:

- proton/codec/decoder.hpp