CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::CBOR::Binary Struct Reference

Represents a CBOR byte string (or binary). More...

#include <CeresEngine/Foundation/CBOR.hpp>

Public Member Functions

 Binary (InputStream stream)
 Creates a new binary object from a input stream.
 
 Binary (const MemoryView< const Byte > &data)
 Creates a new binary from a memory view.
 
 Binary (InputStream stream, const UInt64 limit)
 Creates a new limited read stream.
 

Public Attributes

InputStream stream
 The stream that contains the binary data either being written or read.
 

Detailed Description

Represents a CBOR byte string (or binary).

A byte string in CBOR is a sequence of bytes, analogous, but not limited, to an array of 8-bit characters.

CBOR provides two forms of binary string lengths: definite length and indefinite length.

A definite length byte string is prefixed the actual length of the data. After the length prefix, the actual binary data follows in its raw form. The encoder will use definite length byte strings if the size of the given stream is known,

An indefinite length byte string is a sequence of definite length byte strings. An indefinite length byte string is encoded as a multiple definite length byte strings. This allows the construction of large byte strings without first having to calculate the size. Each chunk of binary data can be written as it becomes available. The encoder will use indefinite length byte strings if the size of the given stream is not known.

NOTE: Indefinite byte strings don't require manual breaking. The encoder and the decoder will handle that automatically. NOTE: When decoding from a indefinite length byte string stream, the contents of the stream MUST be consumed before decoding the next value, as the data is proxied directly from the underlying CBOR decoding stream.

Constructor & Destructor Documentation

◆ Binary() [1/3]

CeresEngine::CBOR::Binary::Binary ( InputStream  stream)
inlineexplicit

Creates a new binary object from a input stream.

◆ Binary() [2/3]

CeresEngine::CBOR::Binary::Binary ( const MemoryView< const Byte > &  data)
inlineexplicit

Creates a new binary from a memory view.

◆ Binary() [3/3]

CeresEngine::CBOR::Binary::Binary ( InputStream  stream,
const UInt64  limit 
)
inlineexplicit

Creates a new limited read stream.

Member Data Documentation

◆ stream

InputStream CeresEngine::CBOR::Binary::stream
mutable

The stream that contains the binary data either being written or read.


The documentation for this struct was generated from the following file: