API Documentation
Static Public Member Functions | List of all members
nkImages::CompositeEncoder Class Referencefinal

Utility encoder using all other encoders within nkImages to parse arbitrary data. More...

Static Public Member Functions

static bool canDecode (nkMemory::BufferView< unsigned char > data)
 
static Image decode (nkMemory::BufferView< unsigned char > data, const AlignmentDescriptor &alignmentDescriptor=AlignmentDescriptor())
 

Detailed Description

Utility encoder using all other encoders within nkImages to parse arbitrary data.

This encoder's job is to delegate decoding to other encoders defined in the component. This means that for a given binary buffer, it will sequentially test it against all other encoders to select one that can decode the data into an image.
Cost is about looping into an array recording all encoders and calling their canDecode() method to know if data is compatible before calling the right decoding method.

Member Function Documentation

◆ canDecode()

static bool nkImages::CompositeEncoder::canDecode ( nkMemory::BufferView< unsigned char >  data)
static

Checks whether the data provided can be decoded by one of the encoders available.

Parameters
dataThe binary data to decode.
Returns
Whether the decoding is possible (true) or not (false).

◆ decode()

static Image nkImages::CompositeEncoder::decode ( nkMemory::BufferView< unsigned char >  data,
const AlignmentDescriptor alignmentDescriptor = AlignmentDescriptor() 
)
static

Decodes a binary buffer into an image representation, by first finding which encoder is compatible with the data.

Parameters
dataThe data to decode.
alignmentDescriptorThe memory alignment constraints, if any.
Returns
The decoded image if a compatible encoder could be found, an empty image else.

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