QSafeBitmapFileReader Class


The QSafeBitmapFileReader class reads the bitmap data from the file. More...

Header: #include <QSafeBitmapFileReader>
Since: QtSafeRenderer 1.0
Inherits: SafeRenderer::QSafeBitmapReader

Public Types

enum BitmapFileReaderException { IndexOutOfBounds, TooMany, SizeError, DataCorrupted }

Public Functions

virtual ~QSafeBitmapFileReader()
virtual void loadBitmapFile(const qchar * const file, const quint32 crc)

Reimplemented Public Functions

virtual QSafeBitmap *getBitmapByID(const quint32 hash)

Detailed Description

The QSafeBitmapFileReader class reads the bitmap data from the file.

Reads the given bitmap file, validates it, and loads the bitmap data.

Member Type Documentation

enum QSafeBitmapFileReader::BitmapFileReaderException

This enum describes the exception values of the class QSafeBitmap

SafeRenderer::QSafeBitmapFileReader::IndexOutOfBounds3The bitmap index exceeds SafeRenderer::Constraints::MAX_AMOUNT_OF_BITMAPS.
SafeRenderer::QSafeBitmapFileReader::TooMany0The number of bitmaps exceed the MAXIMUM value.
SafeRenderer::QSafeBitmapFileReader::SizeError1The bitmap data is too big to fit in a buffer, exceeds SafeRenderer::Constraints::MAX_IMAGE_PIXELS, or the bitmap size does not match the defined width and height.
SafeRenderer::QSafeBitmapFileReader::DataCorrupted2The read data does not pass a checksum.

Member Function Documentation


Constructs the QSafeBitmapFileReader object.

[virtual] QSafeBitmapFileReader::~QSafeBitmapFileReader()

Destroys the instance of QSafeBitmapFileReader. The destructor is virtual.

[virtual] QSafeBitmap *QSafeBitmapFileReader::getBitmapByID(const quint32 hash)

Reimplemented from QSafeBitmapReader::getBitmapByID().

Returns the pointer to the bitmap data that is identified by hash. The hash value is the hash value of the bitmap file name. Hash can be calculated with SafeRenderer::qsafe_hash function.

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

SafeRenderer::QSafeBitmapFileReader::BitmapFileReaderException::IndexOutOfBoundsThe bitmap index exceeds the value defined in SafeRenderer::Constraints::MAX_AMOUNT_OF_BITMAPS.

[virtual] void QSafeBitmapFileReader::loadBitmapFile(const qchar * const file, const quint32 crc)

Loads the given in file. The checksum of the file needs to match with crc.

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

SafeRenderer::QSafeBitmapFileReader::TooManyThe number of bitmaps exceeds the MAXIMUM value.
SafeRenderer::QSafeBitmapFileReader::BitmapFileReaderException::IndexOutOfBoundsThe bitmap index exceeds SafeRenderer::Constraints::MAX_AMOUNT_OF_BITMAPS.
SafeRenderer::QSafeBitmapFileReader::DataCorruptedThe read data does not pass a checksum.
SafeRenderer::QSafeBitmapFileReader::SizeErrorThe bitmap data is too long to fit in a buffer, it exceeds SafeRenderer::Constraints::MAX_IMAGE_PIXELS, or its size does not match the defined width and height, or is shorter than SafeRenderer::Constraints::BITMAPDATA_HEADER_SIZE
SafeRenderer::QSafeFile::FileException::FailureToOpenThe file could not be opened for reading.
SafeRenderer::QSafeFile::FileException::SeekErrorSeek failed on the opened file. For example, a filesystem error occurred or file was pipe.
SafeRenderer::QSafeFile::FileException::ReadErrorThe requested number of bytes could not be read from the opened file.

Available under certain Qt licenses.
Find out more.