PACK WOC  $VERSION$
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
MFile Class Reference

overwrites QFile to only generate a file if its new version differs from an existing one, it creates a temporary file with ",new" added to the file name; additionally it records all file names that it touches; this is not a complete implementation - just enough for woc; it assumes that files are opened to be (re)created More...

#include <mfile.h>

Inheritance diagram for MFile:

Public Member Functions

 MFile (QString name, QObject *parent=0)
 creates a new file (tentatively) with the given name (temporarily with ",new" appended) More...
 
 MFile (QObject *parent=0)
 creates a file object More...
 
 ~MFile ()
 implicitly closes the file More...
 
virtual void close ()
 compares the old (if it exists) and new version of the file and overwrites the old one if there are differences More...
 
virtual bool open (QIODevice::OpenMode m=QIODevice::WriteOnly)
 opens the file, WriteOnly is assumed as mode More...
 
QString fileName () const
 returns the name of the file (without ",new") More...
 
void setFileName (QString n)
 sets the file name for the file to be written; must be called before it is opened More...
 

Static Public Member Functions

static bool touchedFile (QString)
 returns true if that file name has been touched yet More...
 

Private Attributes

bool isopen
 
QString name
 

Static Private Attributes

static QMap< QString, QStringList > touched
 

Detailed Description

overwrites QFile to only generate a file if its new version differs from an existing one, it creates a temporary file with ",new" added to the file name; additionally it records all file names that it touches; this is not a complete implementation - just enough for woc; it assumes that files are opened to be (re)created

Constructor & Destructor Documentation

MFile::MFile ( QString  name,
QObject *  parent = 0 
)

creates a new file (tentatively) with the given name (temporarily with ",new" appended)

MFile::MFile ( QObject *  parent = 0)

creates a file object

MFile::~MFile ( )

implicitly closes the file

Member Function Documentation

void MFile::close ( )
virtual

compares the old (if it exists) and new version of the file and overwrites the old one if there are differences

QString MFile::fileName ( ) const
inline

returns the name of the file (without ",new")

bool MFile::open ( QIODevice::OpenMode  m = QIODevice::WriteOnly)
virtual

opens the file, WriteOnly is assumed as mode

void MFile::setFileName ( QString  n)

sets the file name for the file to be written; must be called before it is opened

bool MFile::touchedFile ( QString  name)
static

returns true if that file name has been touched yet

Member Data Documentation

bool MFile::isopen
private
QString MFile::name
private
QMap< QString, QStringList > MFile::touched
staticprivate

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