Unsettled API** - A stream-like encoder from C++ values to AMQP bytes. For internal use only. @see @ref types_page for the recommended ways to manage AMQP data
| 48 | /// |
| 49 | /// @see @ref types_page for the recommended ways to manage AMQP data |
| 50 | class encoder : public internal::data { |
| 51 | public: |
| 52 | /// Wrap Proton-C data object. |
| 53 | explicit encoder(const data& d) : data(d) {} |
| 54 | |
| 55 | /// Encoder into v. Clears any current value in v. |
| 56 | PN_CPP_EXTERN explicit encoder(internal::value_base& v); |
| 57 | |
| 58 | /// Encode the current values into buffer and update size to reflect the |
| 59 | /// number of bytes encoded. |
| 60 | /// |
| 61 | /// Clears the encoder. |
| 62 | /// |
| 63 | /// @return if buffer == 0 or size is too small, then return false |
| 64 | /// and size to the required size. Otherwise, return true and set |
| 65 | /// size to the number of bytes encoded. |
| 66 | PN_CPP_EXTERN bool encode(char* buffer, size_t& size); |
| 67 | |
| 68 | /// Encode the current values into a std::string and resize the |
| 69 | /// string if necessary. Clears the encoder. |
| 70 | PN_CPP_EXTERN void encode(std::string&); |
| 71 | |
| 72 | /// Encode the current values into a std::string. Clears the |
| 73 | /// encoder. |
| 74 | PN_CPP_EXTERN std::string encode(); |
| 75 | |
| 76 | /// @name Insert built-in types |
| 77 | /// @{ |
| 78 | PN_CPP_EXTERN encoder& operator<<(bool); |
| 79 | PN_CPP_EXTERN encoder& operator<<(uint8_t); |
| 80 | PN_CPP_EXTERN encoder& operator<<(int8_t); |
| 81 | PN_CPP_EXTERN encoder& operator<<(uint16_t); |
| 82 | PN_CPP_EXTERN encoder& operator<<(int16_t); |
| 83 | PN_CPP_EXTERN encoder& operator<<(uint32_t); |
| 84 | PN_CPP_EXTERN encoder& operator<<(int32_t); |
| 85 | PN_CPP_EXTERN encoder& operator<<(wchar_t); |
| 86 | PN_CPP_EXTERN encoder& operator<<(uint64_t); |
| 87 | PN_CPP_EXTERN encoder& operator<<(int64_t); |
| 88 | PN_CPP_EXTERN encoder& operator<<(timestamp); |
| 89 | PN_CPP_EXTERN encoder& operator<<(float); |
| 90 | PN_CPP_EXTERN encoder& operator<<(double); |
| 91 | PN_CPP_EXTERN encoder& operator<<(decimal32); |
| 92 | PN_CPP_EXTERN encoder& operator<<(decimal64); |
| 93 | PN_CPP_EXTERN encoder& operator<<(decimal128); |
| 94 | PN_CPP_EXTERN encoder& operator<<(const uuid&); |
| 95 | PN_CPP_EXTERN encoder& operator<<(const std::string&); |
| 96 | PN_CPP_EXTERN encoder& operator<<(const symbol&); |
| 97 | PN_CPP_EXTERN encoder& operator<<(const binary&); |
| 98 | PN_CPP_EXTERN encoder& operator<<(const scalar_base&); |
| 99 | PN_CPP_EXTERN encoder& operator<<(const null&); |
| 100 | PN_CPP_EXTERN encoder& operator<<(decltype(nullptr)); |
| 101 | /// @} |
| 102 | |
| 103 | /// Insert a proton::value. |
| 104 | /// |
| 105 | /// @internal NOTE insert value_base, not value to avoid recursive |
| 106 | /// implicit conversions. |
| 107 | PN_CPP_EXTERN encoder& operator<<(const internal::value_base&); |