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>
List of all members.
Public Member Functions |
| MFile (QString name, QObject *parent=0) |
| creates a new file (tentatively) with the given name (temporarily with ",new" appended)
|
| MFile (QObject *parent=0) |
| creates a file object
|
| ~MFile () |
| implicitly closes the file
|
virtual void | close () |
| compares the old (if it exists) and new version of the file and overwrites the old one if there are differences
|
virtual bool | open (QIODevice::OpenMode m=QIODevice::WriteOnly) |
| opens the file, WriteOnly is assumed as mode
|
QString | fileName () const |
| returns the name of the file (without ",new")
|
void | setFileName (QString n) |
| sets the file name for the file to be written; must be called before it is opened
|
Static Public Member Functions |
static bool | touchedFile (QString) |
| returns true if that file name has been touched yet
|
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 |
) |
|
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
The documentation for this class was generated from the following files: