#include <abstractdiskio.h>
Protected Member Functions | |
AbstractDiskIO (QIODevice::OpenMode openmode) | |
normal constructor | |
virtual | ~AbstractDiskIO () |
normal destructor | |
void | setFile (QString filename) |
open a file | |
QString | filename () const |
Return the current filename or "". | |
qint64 | pos () const |
The current position in the file. | |
qint64 | fileSize () const |
The size of the file. | |
Protected Attributes | |
Stream * | _stream |
the access to the file | |
QFile * | _file |
Private Attributes | |
QIODevice::OpenMode | _openmode |
opens files for reading/writing and sets the QTextstream _stream accordingly
NSDiskIO::AbstractDiskIO< Stream >::AbstractDiskIO | ( | QIODevice::OpenMode | openmode | ) | [inline, protected] |
normal constructor
openmode | the QIODevice::OpenMode for this file |
virtual NSDiskIO::AbstractDiskIO< Stream >::~AbstractDiskIO | ( | ) | [inline, protected, virtual] |
normal destructor
calls setFile( "" ) to close the open file
void NSDiskIO::AbstractDiskIO< Stream >::setFile | ( | QString | filename | ) | [inline, protected] |
open a file
When called with an argument the old opened file is closed and the new one is opened if it exists. When the argument is just empty ( "" or QString::Null ) the current file is closed.
If opening of the file fails for some reason, it closes the file and resets the state.
filename | The path and name of the file to open. |
Reimplemented in NSDiskIO::CSVWriter, NSDiskIO::EPOSReader, NSDiskIO::CombinedCSV, NSDiskIO::EPOSBinWriter, NSDiskIO::EPOSBinReader, NSDiskIO::PragReader, and GageReader.
Referenced by NSDiskIO::AbstractDiskIO< QDataStream >::setFile(), and NSDiskIO::AbstractDiskIO< QDataStream >::~AbstractDiskIO().
QString NSDiskIO::AbstractDiskIO< Stream >::filename | ( | ) | const [inline, protected] |
Return the current filename or "".
Reimplemented in NSDiskIO::EPOSReader, NSDiskIO::EPOSBinReader, NSDiskIO::PragReader, and GageReader.
qint64 NSDiskIO::AbstractDiskIO< Stream >::pos | ( | ) | const [inline, protected] |
The current position in the file.
qint64 NSDiskIO::AbstractDiskIO< Stream >::fileSize | ( | ) | const [inline, protected] |
The size of the file.
Stream* NSDiskIO::AbstractDiskIO< Stream >::_stream [protected] |
the access to the file
Access the file through this stream. Don't delete this stream!
Referenced by NSDiskIO::AbstractDiskIO< QDataStream >::setFile().
QFile* NSDiskIO::AbstractDiskIO< Stream >::_file [protected] |
QIODevice::OpenMode NSDiskIO::AbstractDiskIO< Stream >::_openmode [private] |
Referenced by NSDiskIO::AbstractDiskIO< QDataStream >::setFile().