You.i Engine
CYIAssetDecoder Class Referenceabstract

Detailed Description

Base class for all specialized decoders.

Programmers must extend this class for any specific asset file formats. All decoders must be registered through the CYIAssetLoader interface, if they want to be used by the You.i Engine framework.

#include <asset/YiAssetDecoder.h>

Inheritance diagram for CYIAssetDecoder:

Public Member Functions

 CYIAssetDecoder (const CYIRuntimeTypeInfo &assetType)
 
virtual ~CYIAssetDecoder ()
 
virtual bool IsExtensionSupported (const CYIString &extension)
 
virtual bool IsFormatSupported (const uint8_t *pData, size_t dataSize)=0
 
virtual bool SupportsParams (const CYIAssetLoadParams *pDecodeParams)
 
virtual bool SupportsType (const CYIRuntimeTypeInfo &assetType)
 
virtual std::shared_ptr< CYIAssetDecodeAsset (const CYIString &path, const CYIAssetLoadParams *pDecodeParams=nullptr, CYITaskBase *pTask=nullptr)=0
 
virtual std::shared_ptr< CYIAssetDecodeAsset (const uint8_t *pData, size_t dataSize, const CYIAssetLoadParams *pDecodeParams=nullptr, CYITaskBase *pTask=nullptr)=0
 
virtual bool DecodeAsset (const std::shared_ptr< CYIAsset > &pAsset, CYITaskBase *pTask=nullptr)=0
 
virtual bool DecodeAsset (const std::shared_ptr< CYIAsset > &pAsset, const uint8_t *pData, size_t dataSize, CYITaskBase *pTask=nullptr)=0
 
CYIString GetExtension () const
 
const std::vector< CYIString > & GetExtensions () const
 

Protected Attributes

std::vector< CYIStringm_SupportedExtensions
 
const CYIRuntimeTypeInfom_AssetType
 

Constructor & Destructor Documentation

◆ CYIAssetDecoder()

CYIAssetDecoder::CYIAssetDecoder ( const CYIRuntimeTypeInfo assetType)

◆ ~CYIAssetDecoder()

virtual CYIAssetDecoder::~CYIAssetDecoder ( )
virtual

Member Function Documentation

◆ DecodeAsset() [1/4]

virtual std::shared_ptr<CYIAsset> CYIAssetDecoder::DecodeAsset ( const CYIString path,
const CYIAssetLoadParams pDecodeParams = nullptr,
CYITaskBase pTask = nullptr 
)
pure virtual

Decode an asset at the specified path using the optional decoding parameters pDecodeParams. The pDecodeParams can be nullptr.

Implemented in CYIAssetDecoderJSON, CYIAssetDecoderScript, CYIAssetDecoderTemplate, CYIAssetDecoderTimelineSource, CYIAssetDecoderImage, CYIAssetDecoderTranslation, CYIAssetDecoderVideo, CYIAssetDecoderBif, CYIAssetDecoderShaderObject, CYIAssetDecoderWAV, and CYIAssetDecoderPNG.

◆ DecodeAsset() [2/4]

virtual std::shared_ptr<CYIAsset> CYIAssetDecoder::DecodeAsset ( const uint8_t *  pData,
size_t  dataSize,
const CYIAssetLoadParams pDecodeParams = nullptr,
CYITaskBase pTask = nullptr 
)
pure virtual

Decode an asset using pre-loaded file data pData, dataSize, and the optional decoding parameters pDecodeParams. The pDecodeParams can be nullptr.

Implemented in CYIAssetDecoderJSON, CYIAssetDecoderScript, CYIAssetDecoderTemplate, CYIAssetDecoderTimelineSource, CYIAssetDecoderImage, CYIAssetDecoderTranslation, CYIAssetDecoderVideo, CYIAssetDecoderBif, CYIAssetDecoderShaderObject, CYIAssetDecoderWAV, and CYIAssetDecoderPNG.

◆ DecodeAsset() [3/4]

virtual bool CYIAssetDecoder::DecodeAsset ( const std::shared_ptr< CYIAsset > &  pAsset,
CYITaskBase pTask = nullptr 
)
pure virtual

◆ DecodeAsset() [4/4]

virtual bool CYIAssetDecoder::DecodeAsset ( const std::shared_ptr< CYIAsset > &  pAsset,
const uint8_t *  pData,
size_t  dataSize,
CYITaskBase pTask = nullptr 
)
pure virtual

Decode an asset using an existing asset instance, and pre-loaded file data pData and dataSize. The optional decoding parameters may be set through CYIAsset::SetLoadParameters. Returns true if the decoding was successful, false otherwise.

See also
CYIAsset::SetLoadParameters(std::unique_ptr<CYIAssetLoadParams>)

Implemented in CYIAssetDecoderTemplate, CYIAssetDecoderTimelineSource, CYIAssetDecoderJSON, CYIAssetDecoderScript, CYIAssetDecoderImage, CYIAssetDecoderTranslation, CYIAssetDecoderWAV, CYIAssetDecoderBif, CYIAssetDecoderShaderObject, and CYIAssetDecoderVideo.

◆ GetExtension()

CYIString CYIAssetDecoder::GetExtension ( ) const

Return the first extension supported by the decoder, or an empty string if no extension is available.

◆ GetExtensions()

const std::vector<CYIString>& CYIAssetDecoder::GetExtensions ( ) const

Returns all extensions supported by the decoder.

◆ IsExtensionSupported()

virtual bool CYIAssetDecoder::IsExtensionSupported ( const CYIString extension)
virtual

Returns true if the supplied extension is supported by this decoder. For consistency, supported extensions should be supplied by the decoder in lower case and no leading '.' characters. File names with multiple extensions should be specificed like "a.b".

◆ IsFormatSupported()

virtual bool CYIAssetDecoder::IsFormatSupported ( const uint8_t *  pData,
size_t  dataSize 
)
pure virtual

Returns true if the file format is supported. The file contents are supplied through pData and the size of the buffer must be given through dataSize.

Implemented in CYIAssetDecoderTemplate, CYIAssetDecoderTimelineSource, CYIAssetDecoderJSON, CYIAssetDecoderBif, CYIAssetDecoderScript, CYIAssetDecoderShaderObject, CYIAssetDecoderVideo, CYIAssetDecoderWAV, CYIAssetDecoderImage, and CYIAssetDecoderTranslation.

◆ SupportsParams()

virtual bool CYIAssetDecoder::SupportsParams ( const CYIAssetLoadParams pDecodeParams)
virtual

◆ SupportsType()

virtual bool CYIAssetDecoder::SupportsType ( const CYIRuntimeTypeInfo assetType)
virtual

Returns true if the decoder supports a specialized asset type.

Member Data Documentation

◆ m_AssetType

const CYIRuntimeTypeInfo& CYIAssetDecoder::m_AssetType
protected

◆ m_SupportedExtensions

std::vector<CYIString> CYIAssetDecoder::m_SupportedExtensions
protected

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