#include <Cbor.h>
Aws::Crt::Cbor::CborDecoder::CborDecoder |
( |
const CborDecoder & |
| ) |
|
|
delete |
Aws::Crt::Cbor::CborDecoder::CborDecoder |
( |
CborDecoder && |
| ) |
|
|
delete |
Construct a new Cbor Decoder object
- Parameters
-
allocator | |
src | The src data to decode from. |
Aws::Crt::Cbor::CborDecoder::~CborDecoder |
( |
| ) |
|
|
noexcept |
bool Aws::Crt::Cbor::CborDecoder::ConsumeNextSingleElement |
( |
| ) |
|
|
noexcept |
Consume the next single element, without the content followed by the element.
As an example for the following CBOR, this function will only consume the 0xBF, "Start indefinite-length map", not any content of the map represented. The next element to decode will start from 0x63. 0xbf6346756ef563416d7421ff BF – Start indefinite-length map 63 – First key, UTF-8 string length 3 46756e – "Fun" F5 – First value, true 63 – Second key, UTF-8 string length 3 416d74 – "Amt" 21 – Second value, -2 FF – "break"
- Returns
- true if the operation succeed, false otherwise and LastError() will contain the errorCode.
bool Aws::Crt::Cbor::CborDecoder::ConsumeNextWholeDataItem |
( |
| ) |
|
|
noexcept |
Consume the next data item, includes all the content within the data item.
As an example for the following CBOR, this function will consume all the data as it's only one CBOR data item, an indefinite map with 2 key, value pair: 0xbf6346756ef563416d7421ff BF – Start indefinite-length map 63 – First key, UTF-8 string length 3 46756e – "Fun" F5 – First value, true 63 – Second key, UTF-8 string length 3 416d74 – "Amt" 21 – Second value, -2 FF – "break"
Notes: this function will not ensure the data item is well-formed.
- Returns
- true if the operation succeed, false otherwise and LastError() will contain the errorCode.
size_t Aws::Crt::Cbor::CborDecoder::GetRemainingLength |
( |
| ) |
|
|
noexcept |
Get the length of the remaining bytes of the source. Once the source was decoded, it will be consumed, and result in decrease of the remaining length of bytes.
- Returns
- The length of bytes remaining of the decoder source.
int Aws::Crt::Cbor::CborDecoder::LastError |
( |
| ) |
const |
|
inlinenoexcept |
- Returns
- the value of the last aws error encountered by operations on this instance.
Decode the next element and store it in the decoder cache if there was no element cached. If there was an element cached, just return the type of the cached element.
- Returns
- If successful, return the type of next element If not, return will be none and LastError() can be used to retrieve CRT error code.
Optional< uint64_t > Aws::Crt::Cbor::CborDecoder::PopNextArrayStart |
( |
| ) |
|
|
noexcept |
Get the next ArrayStart element. Only consume the ArrayStart element and set the size of array to &out_size, not the content of the array. The next &out_size CBOR data items will be the content of the array for a valid CBOR data.
Notes: For indefinite-length, this function will fail with "AWS_ERROR_CBOR_UNEXPECTED_TYPE". The designed way to handle indefinite-length is:
- Get IndefArrayStart from PeekType
- Call ConsumeNextSingleElement to pop the indefinite-length start.
- Decode the next data item until Break is read.
- Returns
- If successful, return the size of array If not, return will be none and LastError() can be used to retrieve CRT error code.
Optional< bool > Aws::Crt::Cbor::CborDecoder::PopNextBooleanVal |
( |
| ) |
|
|
noexcept |
Optional< double > Aws::Crt::Cbor::CborDecoder::PopNextFloatVal |
( |
| ) |
|
|
noexcept |
Optional< uint64_t > Aws::Crt::Cbor::CborDecoder::PopNextMapStart |
( |
| ) |
|
|
noexcept |
Get the next MapStart element. Only consume the MapStart element and set the size of array to &out_size, not the content of the map. The next &out_size pair of CBOR data items as key and value will be the content of the array for a valid CBOR data.
Notes: For indefinite-length, this function will fail with "AWS_ERROR_CBOR_UNEXPECTED_TYPE". The designed way to handle indefinite-length is:
- Get IndefMapStart from PeekType
- Call ConsumeNextSingleElement to pop the indefinite-length start.
- Decode the next data item until Break is read.
- Returns
- If successful, return the size of map If not, return will be none and LastError() can be used to retrieve CRT error code.
Optional< uint64_t > Aws::Crt::Cbor::CborDecoder::PopNextNegativeIntVal |
( |
| ) |
|
|
noexcept |
Optional< uint64_t > Aws::Crt::Cbor::CborDecoder::PopNextTagVal |
( |
| ) |
|
|
noexcept |
Get the next Tag element. Only consume the Tag element and set the tag value to out_tag_val, not the content of the tagged value. The next CBOR data item will be the content of the tagged value for a valid CBOR data.
- Returns
- If successful, return the tag value If not, return will be none and LastError() can be used to retrieve CRT error code.
Optional< uint64_t > Aws::Crt::Cbor::CborDecoder::PopNextUnsignedIntVal |
( |
| ) |
|
|
noexcept |
Get the next element based on the type. If the next element doesn't match the expected type, an error will be raised. If the next element has already been cached, it will consume the cached item when no error was returned. Specifically:
- UInt - PopNextUnsignedIntVal
- NegInt - PopNextNegativeIntVal, it represents (-1 - &out)
- Float - PopNextFloatVal
- Bytes - PopNextBytesVal
- Text - PopNextTextVal
- Returns
- If successful, return the next element If not, return will be none and LastError() can be used to retrieve CRT error code.
The documentation for this class was generated from the following files: