xentara-utils v2.0.4
The Xentara Utility Library
|
A class that encodes CBOR data types that includes: unsigned integers, negative integers, byte strings, text strings encoded as UTF8, simple values and float-point number. More...
#include <xentara/utils/cbor/Encoder.hpp>
Public Member Functions | |
Encoder (std::reference_wrapper< OutputStream< std::byte > > stream) | |
An Encoder Constructor that sets an output stream. | |
template<tools::UnsignedIntegral Type> | |
auto | operator<< (Type value) -> Encoder & |
Enocdes a unsigned integeral value. | |
template<tools::SignedIntegral Type> | |
auto | operator<< (Type value) -> Encoder & |
Encodes signed/unsigned integeral value. | |
template<std::ranges::contiguous_range Data> requires std::same_as<std::remove_cv_t<std::ranges::range_value_t<Data>>, std::byte> | |
auto | operator<< (const Data &data) -> Encoder & |
Encodes byte string of opaque bytes. | |
template<std::convertible_to< std::string_view > String> | |
auto | operator<< (const String &string) -> Encoder & |
Encodes text string of unicode characters that is encoded as UTF-8. | |
auto | operator<< (float value) -> Encoder & |
Encodes float value. | |
auto | operator<< (double value) -> Encoder & |
Encodes double value. | |
auto | operator<< (bool value) -> Encoder & |
Encodes bool value. | |
auto | operator<< (NullTag tag) -> Encoder & |
Encodes a CBOR null value (simple value 22) | |
auto | operator<< (UndefinedTag tag) -> Encoder & |
Encodes a CBOR undefined value (simple value 23) | |
auto | operator<< (Tag value) -> Encoder & |
Encodes a CBOR data item tag. | |
auto | operator<< (SimpleValue value) -> Encoder & |
Encodes an arbitrary CBOR simple value. | |
auto | operator<< (const Array &array) -> Encoder & |
Encodes the header of a CBOR array. | |
auto | operator<< (const Map &map) -> Encoder & |
Encodes the header of a CBOR array. | |
template<typename Value > requires (!std::same_as<Value, NullTag> && !std::same_as<Value, BreakTag>) | |
auto | operator<< (const std::optional< Value > &optional) -> Encoder & |
Encodes an option value. | |
auto | operator<< (BreakTag tag) -> Encoder & |
Encodes a CBOR break value (simple value 31) | |
auto | operator<< (AlternativeValue value) -> Encoder & |
Encodes a CBOR alternative value. | |
A class that encodes CBOR data types that includes: unsigned integers, negative integers, byte strings, text strings encoded as UTF8, simple values and float-point number.
xentara::utils::cbor::Encoder::Encoder | ( | std::reference_wrapper< OutputStream< std::byte > > | stream | ) |
An Encoder Constructor that sets an output stream.
stream | Output Stream |
auto xentara::utils::cbor::Encoder::operator<< | ( | AlternativeValue | value | ) | -> Encoder & |
Encodes a CBOR alternative value.
value | A value to encode |
auto xentara::utils::cbor::Encoder::operator<< | ( | bool | value | ) | -> Encoder & |
Encodes bool value.
value | A value to encode |
Encodes a CBOR break value (simple value 31)
tag | Always pass kBreak as this parameter |
Encodes the header of a CBOR array.
This function only encodes the header of the array, consisting of the major type and the length. The array elements and (for indefinite length arrays) the stop code must be encoded separately.
array | The array header to encode |
auto xentara::utils::cbor::Encoder::operator<< | ( | const Data & | data | ) | -> Encoder & |
Encodes byte string of opaque bytes.
data | The data block to encode |
Encodes the header of a CBOR array.
This function only encodes the header of the map, consisting of the major type and the length. The keys and values and (for indefinite length maps) the stop code must be encoded separately.
map | The map header to encode |
auto xentara::utils::cbor::Encoder::operator<< | ( | const std::optional< Value > & | optional | ) | -> Encoder & |
Encodes an option value.
If optional contains a value, it is encoded normally. If optional does not contain a value, a CBOR null value (simple value 22) is encoded instead.
optional | A value to encode |
auto xentara::utils::cbor::Encoder::operator<< | ( | const String & | string | ) | -> Encoder & |
Encodes text string of unicode characters that is encoded as UTF-8.
string | A string to encode |
auto xentara::utils::cbor::Encoder::operator<< | ( | double | value | ) | -> Encoder & |
Encodes double value.
value | A value to encode |
auto xentara::utils::cbor::Encoder::operator<< | ( | float | value | ) | -> Encoder & |
Encodes float value.
value | A value to encode |
Encodes a CBOR null value (simple value 22)
tag | Always pass kNull as this parameter |
auto xentara::utils::cbor::Encoder::operator<< | ( | SimpleValue | value | ) | -> Encoder & |
Encodes an arbitrary CBOR simple value.
value | A value to encode |
Encodes a CBOR data item tag.
value | A value to encode |
auto xentara::utils::cbor::Encoder::operator<< | ( | Type | value | ) | -> Encoder & |
Enocdes a unsigned integeral value.
value | A value to encode |
auto xentara::utils::cbor::Encoder::operator<< | ( | Type | value | ) | -> Encoder & |
Encodes signed/unsigned integeral value.
value | A value to encode |
auto xentara::utils::cbor::Encoder::operator<< | ( | UndefinedTag | tag | ) | -> Encoder & |
Encodes a CBOR undefined value (simple value 23)
tag | Always pass kUndefined as this parameter |