aws-crt-cpp
C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++.
Public Member Functions | List of all members
Aws::Crt::Cbor::CborEncoder Class Referencefinal

#include <Cbor.h>

Public Member Functions

 CborEncoder (const CborEncoder &)=delete
 
 CborEncoder (CborEncoder &&)=delete
 
CborEncoderoperator= (const CborEncoder &)=delete
 
CborEncoderoperator= (CborEncoder &&)=delete
 
 CborEncoder (Allocator *allocator=ApiAllocator()) noexcept
 
 ~CborEncoder () noexcept
 
ByteCursor GetEncodedData () noexcept
 
void Reset () noexcept
 
void WriteUInt (uint64_t value) noexcept
 
void WriteNegInt (uint64_t value) noexcept
 
void WriteFloat (double value) noexcept
 
void WriteBytes (ByteCursor value) noexcept
 
void WriteText (ByteCursor value) noexcept
 
void WriteArrayStart (size_t number_entries) noexcept
 
void WriteMapStart (size_t number_entries) noexcept
 
void WriteTag (uint64_t tag_number) noexcept
 
void WriteNull () noexcept
 
void WriteUndefined () noexcept
 
void WriteBool (bool value) noexcept
 
void WriteBreak () noexcept
 
void WriteIndefBytesStart () noexcept
 
void WriteIndefTextStart () noexcept
 
void WriteIndefArrayStart () noexcept
 
void WriteIndefMapStart () noexcept
 

Constructor & Destructor Documentation

Aws::Crt::Cbor::CborEncoder::CborEncoder ( const CborEncoder )
delete
Aws::Crt::Cbor::CborEncoder::CborEncoder ( CborEncoder &&  )
delete
Aws::Crt::Cbor::CborEncoder::CborEncoder ( Crt::Allocator allocator = ApiAllocator())
noexcept
Aws::Crt::Cbor::CborEncoder::~CborEncoder ( )
noexcept

Member Function Documentation

ByteCursor Aws::Crt::Cbor::CborEncoder::GetEncodedData ( )
noexcept

Get the current encoded data from encoder. The encoded data has the same lifetime as the encoder, and once any other function call invoked for the encoder, the encoded data is no longer valid.

Returns
the current encoded data
CborEncoder& Aws::Crt::Cbor::CborEncoder::operator= ( const CborEncoder )
delete
CborEncoder& Aws::Crt::Cbor::CborEncoder::operator= ( CborEncoder &&  )
delete
void Aws::Crt::Cbor::CborEncoder::Reset ( )
noexcept

Clear the current encoded buffer from encoder.

void Aws::Crt::Cbor::CborEncoder::WriteArrayStart ( size_t  number_entries)
noexcept

Encode an ArrayStart value to "smallest possible" in encoder's buffer. Referring to RFC8949 section 4.2.1 Notes: it's user's responsibility to keep the integrity of the array to be encoded.

Parameters
number_entriesthe number of CBOR data items to be followed as the content of the array.
void Aws::Crt::Cbor::CborEncoder::WriteBool ( bool  value)
noexcept

Encode a simple value Bool

void Aws::Crt::Cbor::CborEncoder::WriteBreak ( )
noexcept

Encode a simple value Break Notes: no error checking, it's user's responsibility to track the break to close the corresponding indef_start

void Aws::Crt::Cbor::CborEncoder::WriteBytes ( ByteCursor  value)
noexcept

Encode a Bytes value to "smallest possible" in encoder's buffer. Referring to RFC8949 section 4.2.1, the length of "value" will be encoded first and then the value of "value" will be followed.

Parameters
valuevalue to encode.
void Aws::Crt::Cbor::CborEncoder::WriteFloat ( double  value)
noexcept

Encode a AWS_CBOR_TYPE_FLOAT value to "smallest possible", but will not be encoded into half-precision float, as it's not well supported cross languages.

To be more specific, it will be encoded into integer/negative/float (Order with priority) when the conversion will not cause precision loss.

Parameters
valuevalue to encode.
void Aws::Crt::Cbor::CborEncoder::WriteIndefArrayStart ( )
noexcept

Encode an IndefArrayStart Notes: no error checking, it's user's responsibility to add corresponding data and the break to close the indef_start

void Aws::Crt::Cbor::CborEncoder::WriteIndefBytesStart ( )
noexcept

Encode an IndefBytesStart Notes: no error checking, it's user's responsibility to add corresponding data and the break to close the indef_start

void Aws::Crt::Cbor::CborEncoder::WriteIndefMapStart ( )
noexcept

Encode an IndefMapStart Notes: no error checking, it's user's responsibility to add corresponding data and the break to close the indef_start

void Aws::Crt::Cbor::CborEncoder::WriteIndefTextStart ( )
noexcept

Encode an IndefTextStart Notes: no error checking, it's user's responsibility to add corresponding data and the break to close the indef_start

void Aws::Crt::Cbor::CborEncoder::WriteMapStart ( size_t  number_entries)
noexcept

Encode a MapStart value to "smallest possible" in encoder's buffer. Referring to RFC8949 section 4.2.1

Notes: it's user's responsibility to keep the integrity of the map to be encoded.

Parameters
number_entriesthe number of pair of CBOR data items as key and value to be followed as the content of the map.
void Aws::Crt::Cbor::CborEncoder::WriteNegInt ( uint64_t  value)
noexcept

Encode a AWS_CBOR_TYPE_NEGINT value to "smallest possible" in encoder's buffer. It represents (-1 - value). Referring to RFC8949 section 4.2.1

Parameters
valuevalue to encode, which is (-1 - represented value)
void Aws::Crt::Cbor::CborEncoder::WriteNull ( )
noexcept

Encode a simple value Null

void Aws::Crt::Cbor::CborEncoder::WriteTag ( uint64_t  tag_number)
noexcept

Encode a Tag value to "smallest possible" in encoder's buffer. Referring to RFC8949 section 4.2.1 The following CBOR data item will be the content of the tagged value. Notes: it's user's responsibility to keep the integrity of the tagged value to follow the RFC8949 section 3.4

Parameters
tag_numberThe tag value to encode.
void Aws::Crt::Cbor::CborEncoder::WriteText ( ByteCursor  value)
noexcept

Encode a Text value to "smallest possible" in encoder's buffer. Referring to RFC8949 section 4.2.1, the length of "value" will be encoded first and then the value of "value" will be followed.

Parameters
valuevalue to encode.
void Aws::Crt::Cbor::CborEncoder::WriteUInt ( uint64_t  value)
noexcept

Encode a AWS_CBOR_TYPE_UINT value to "smallest possible" in encoder's buffer. Referring to RFC8949 section 4.2.1

Parameters
valuevalue to encode.
void Aws::Crt::Cbor::CborEncoder::WriteUndefined ( )
noexcept

Encode a simple value Undefined


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