C

QSafeFile Class

class SafeRenderer::QSafeFile

The QSafeFile class reads the data from the file. More...

Header: #include <QSafeFile>
Since: QtSafeRenderer 1.0

This class was introduced in QtSafeRenderer 1.0.

Public Types

enum FileException { FailureToOpen, SeekError, ReadError }

Public Functions

QSafeFile(const SafeRenderer::qchar *const filenameArg)
~QSafeFile()
SafeRenderer::quint32 available()
void readData(SafeRenderer::quchar *const bufferArg, const SafeRenderer::quint32 bytes) const

Detailed Description

The QSafeFile uses the Posix API for file access.

Member Type Documentation

enum QSafeFile::FileException

This enum describes the exception values in the QSafeFile class.

ConstantValueDescription
SafeRenderer::QSafeFile::FailureToOpen0Could not open the file for reading.
SafeRenderer::QSafeFile::SeekError1Seek has failed on the opened file. For example, a filesystem error or file being a pipe may have caused the error.
SafeRenderer::QSafeFile::ReadError2The requested number of bytes could not be read from the opened file.

Member Function Documentation

QSafeFile::QSafeFile(const SafeRenderer::qchar *const filenameArg)

Constructs the safe file object.

Opens the file named filenameArg.

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

ConstantDescription
SafeRenderer::QSafeFile::FailureToOpenThe file could not be opened for reading.

QSafeFile::~QSafeFile()

Destructs a safe file object.

Closes the file if the file is open.

SafeRenderer::quint32 QSafeFile::available()

Returns the amount of bytes is available in the file.

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

ConstantDescription
SafeRenderer::QSafeFile::SeekErrorSeek has failed on the opened file. For example, a filesystem error or file being a pipe may have caused the error.

void QSafeFile::readData(SafeRenderer::quchar *const bufferArg, const SafeRenderer::quint32 bytes) const

Reads bytes amount of data from the opened file to the bufferArg.

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

ConstantDescription
SafeRenderer::QSafeFile::ReadErrorThe requested number of bytes could not be read from the opened file or the provided buffer is a NULL pointer.

Available under certain Qt licenses.
Find out more.