1 #ifndef PROTON_CODEC_DATA_HPP
2 #define PROTON_CODEC_DATA_HPP
25 #include "../internal/object.hpp"
26 #include "../types_fwd.hpp"
27 #include "../type_id.hpp"
40 class data :
public internal::object<pn_data_t> {
42 data(pn_data_t* d) : internal::object<pn_data_t>(d) {}
46 data() : internal::object<pn_data_t>(0) {}
49 PN_CPP_EXTERN
static data create();
52 PN_CPP_EXTERN
void copy(
const data&);
55 PN_CPP_EXTERN
void clear();
58 PN_CPP_EXTERN
void rewind();
61 PN_CPP_EXTERN
bool empty()
const;
64 PN_CPP_EXTERN
int append(data src);
67 PN_CPP_EXTERN
int appendn(data src,
int limit);
69 PN_CPP_EXTERN
bool next();
70 PN_CPP_EXTERN
void* point()
const;
71 PN_CPP_EXTERN
void restore(
void* h);
77 friend class internal::factory<data>;
79 friend PN_CPP_EXTERN std::ostream&
operator<<(std::ostream&,
const data&);
95 state_guard(data& d) : data_(d), point_(data_.point()), cancel_(
false) {}
98 ~
state_guard() {
if (!cancel_) data_.restore(point_); }
109 bool described_=
false,
size_t size_=0) :
110 type(type_), element(element_), is_described(described_), size(size_) {}
133 #endif // PROTON_CODEC_DATA_HPP
Experimental - Start encoding a complex type.
Definition: data.hpp:105
The null type, contains no data.
Definition: type_id.hpp:39
A descriptor and a value.
Definition: type_id.hpp:60
A sequence of values of the same type.
Definition: type_id.hpp:61
encoder & operator<<(encoder &e, const std::deque< T, A > &x)
std::deque<T> for most T is encoded as an amqp::ARRAY (same type elements)
Definition: deque.hpp:34
A sequence of key-value pairs.
Definition: type_id.hpp:63
Experimental - Save and restore codec state
Definition: data.hpp:87
type_id
An identifier for AMQP types.
Definition: type_id.hpp:38
Experimental - Finish inserting or extracting a complex type.
Definition: data.hpp:128
void cancel()
Discard the saved state.
Definition: data.hpp:101
A sequence of values of mixed types.
Definition: type_id.hpp:62