Template class that dispatches decoding of binary data to registered format-specific decoders.
More...
#include <C:/Code/AeonEngine/engine/include/Decoder.h>
|
| static bool | Decode (T &aOutput, uint32_t aId) |
| | Decodes a resource identified by its CRC32 id.
|
| static bool | Decode (T &aOutput, const std::string &aPath) |
| | Decodes a resource identified by its path string.
|
| static bool | Decode (T &aOutput, const void *aBuffer, size_t aBufferSize) |
| | Decodes data from a raw memory buffer by matching its magic bytes to a registered decoder.
|
| static bool | RegisterDecoder (const std::string &aMagick, const std::function< bool(T &, size_t, const void *) > &aDecoder) |
| | Registers a decoder function for the given magic byte sequence.
|
| static bool | UnregisterDecoder (const std::string &aMagick) |
| | Unregisters the decoder for the given magic byte sequence.
|
template<class T>
class AeonGames::Decoder< T >
Template class that dispatches decoding of binary data to registered format-specific decoders.
- Template Parameters
-
| T | The type of object to decode into. |
Definition at line 32 of file Decoder.h.
◆ Decode() [1/3]
Decodes a resource identified by its path string.
- Parameters
-
| aOutput | Object to receive the decoded data. |
| aPath | Path string whose CRC32 is used to locate the resource. |
- Returns
- true on success, false on failure.
Definition at line 60 of file Decoder.h.
◆ Decode() [2/3]
template<class T>
| bool AeonGames::Decoder< T >::Decode |
( |
T & | aOutput, |
|
|
const void * | aBuffer, |
|
|
size_t | aBufferSize ) |
|
inlinestatic |
Decodes data from a raw memory buffer by matching its magic bytes to a registered decoder.
- Parameters
-
| aOutput | Object to receive the decoded data. |
| aBuffer | Pointer to the data buffer. |
| aBufferSize | Size of the data buffer in bytes. |
- Returns
- true on success, false if no matching decoder is found.
Definition at line 70 of file Decoder.h.
◆ Decode() [3/3]
Decodes a resource identified by its CRC32 id.
- Parameters
-
| aOutput | Object to receive the decoded data. |
| aId | CRC32 identifier of the resource. |
- Returns
- true on success, false on failure.
Definition at line 39 of file Decoder.h.
◆ RegisterDecoder()
template<class T>
| bool AeonGames::Decoder< T >::RegisterDecoder |
( |
const std::string & | aMagick, |
|
|
const std::function< bool(T &, size_t, const void *) > & | aDecoder ) |
|
inlinestatic |
Registers a decoder function for the given magic byte sequence.
- Parameters
-
| aMagick | Magic byte string identifying the format. |
| aDecoder | Function that decodes data of this format. |
- Returns
- true if registration succeeded, false if a decoder for this magic already exists.
Definition at line 88 of file Decoder.h.
◆ UnregisterDecoder()
Unregisters the decoder for the given magic byte sequence.
- Parameters
-
| aMagick | Magic byte string identifying the format to remove. |
- Returns
- true if the decoder was found and removed, false otherwise.
Definition at line 105 of file Decoder.h.
The documentation for this class was generated from the following file: