NSDiskIO::AbstractDiskIO< Stream > Class Template Reference

abstract base for DiskIO-things More...

#include <abstractdiskio.h>

Collaboration diagram for NSDiskIO::AbstractDiskIO< Stream >:

Collaboration graph
[legend]

List of all members.

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


Detailed Description

template<class Stream>
class NSDiskIO::AbstractDiskIO< Stream >

abstract base for DiskIO-things

opens files for reading/writing and sets the QTextstream _stream accordingly

Todo:
enforce every Reader and Writer to give its prefered ending of files and a description for the selection in FileDialog

Constructor & Destructor Documentation

template<class Stream>
NSDiskIO::AbstractDiskIO< Stream >::AbstractDiskIO ( QIODevice::OpenMode  openmode  )  [inline, protected]

normal constructor

Parameters:
openmode the QIODevice::OpenMode for this file

template<class Stream>
virtual NSDiskIO::AbstractDiskIO< Stream >::~AbstractDiskIO (  )  [inline, protected, virtual]

normal destructor

calls setFile( "" ) to close the open file


Member Function Documentation

template<class Stream>
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.

Parameters:
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().

template<class Stream>
QString NSDiskIO::AbstractDiskIO< Stream >::filename (  )  const [inline, protected]

Return the current filename or "".

Reimplemented in NSDiskIO::EPOSReader, NSDiskIO::EPOSBinReader, NSDiskIO::PragReader, and GageReader.

template<class Stream>
qint64 NSDiskIO::AbstractDiskIO< Stream >::pos (  )  const [inline, protected]

The current position in the file.

template<class Stream>
qint64 NSDiskIO::AbstractDiskIO< Stream >::fileSize (  )  const [inline, protected]

The size of the file.


Member Data Documentation

template<class Stream>
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().

template<class Stream>
QFile* NSDiskIO::AbstractDiskIO< Stream >::_file [protected]

template<class Stream>
QIODevice::OpenMode NSDiskIO::AbstractDiskIO< Stream >::_openmode [private]


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

Generated on Tue Apr 12 02:10:29 2011 for epos by  doxygen 1.5.5