C

QSafeStateLoader Class

class SafeRenderer::QSafeStateLoader

The QSafeStateLoader class loads the state definition file. More...

Header: #include <QSafeStateLoader>
Since: QtSafeRenderer 1.2
Inherited By:

SafeRenderer::QSafeStateFileReader and SafeRenderer::QSafeStateResourceReader

This class was introduced in QtSafeRenderer 1.2.

Public Types

enum StateFileReaderException { OutOfCache, DataCorrupted, InvalidData, UnsupportedAnimationType }

Public Functions

QSafeStateLoader(SafeRenderer::QSafeBitmapReader &bitmapReader)
virtual ~QSafeStateLoader()
virtual void loadFile(const SafeRenderer::QSafeFileInfo &fileInfo, const SafeRenderer::quint32 crc, SafeRenderer::QSafeStateTransition &statesArg) = 0
void loadStates(const SafeRenderer::QSafeByteArray &buffer, SafeRenderer::QSafeStateTransition &stateContainer) const

Detailed Description

The QSafeStateLoader class loads the state definition file. QSafeStateLoader is an abstract class. Derived classes must implement the QSafeStateLoader::loadFile method.

Member Type Documentation

enum QSafeStateLoader::StateFileReaderException

This enum describes the safe state loader exceptions.

ConstantValueDescription
SafeRenderer::QSafeStateLoader::OutOfCache0The index is out of cache.
SafeRenderer::QSafeStateLoader::DataCorrupted1Data is corrupted.
SafeRenderer::QSafeStateLoader::InvalidData2Data is invalid.
SafeRenderer::QSafeStateLoader::UnsupportedAnimationType3The animation type is not supported.

Member Function Documentation

QSafeStateLoader::QSafeStateLoader(SafeRenderer::QSafeBitmapReader &bitmapReader)

Constructs a QSafeStateLoader object. Reference to the QSafeBitmapReader instance is given by bitmapReader.

[virtual] QSafeStateLoader::~QSafeStateLoader()

Destructs a QSafeStateLoader object.

[pure virtual] void QSafeStateLoader::loadFile(const SafeRenderer::QSafeFileInfo &fileInfo, const SafeRenderer::quint32 crc, SafeRenderer::QSafeStateTransition &statesArg)

Loads states definitions from the fileInfo to the statesArg. The value of crc must match with the CRC of the file. This function must be implemented in the derived class.

void QSafeStateLoader::loadStates(const SafeRenderer::QSafeByteArray &buffer, SafeRenderer::QSafeStateTransition &stateContainer) const

Loads states definitions from buffer data to the stateContainer.

In case of a failure, one of the following exceptions will be thrown:

ConstantDescription
SafeRenderer::QSafeByteArray::ByteArrayReaderExceptionThe size of the data in the file is inconsistent.
SafeRenderer::QSafeStateLoader::StateFileReaderException::InvalidDataThe animation data contains unknown data types.
SafeRenderer::QSafeStateLoader::StateFileReaderException::UnsupportedAnimationTypeThe type of the animation is not supported.
SafeRenderer::QSafeStates::IndexOutOfBoundsAmount of states is greater than Constraints::MAX_NUM_OF_STATES.
SafeRenderer::QSafeAnimations::IndexOutOfBoundsAmount of transitions is greater than Constraints::MAX_NUM_OF_ANIMATIONS_PER_ITEM.

Available under certain Qt licenses.
Find out more.