ksavefile.h
/*
This file is part of the KDE libraries
Copyright (c) 1999 Waldo Bastian <bastian@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _KSAVEFILE_H_
#define _KSAVEFILE_H_
#include <qstring.h>
#include <stdio.h>
#include <errno.h>
#include <ktempfile.h>
class KSaveFilePrivate;
class KDECORE_EXPORT KSaveFile
{
public:
KSaveFile(const QString &filename, int mode = 0666 );
~KSaveFile();
int status() const
{ return mTempFile.status(); }
QString name() const;
int handle() const
{ return mTempFile.handle(); }
FILE *fstream()
{ return mTempFile.fstream(); }
QFile *file()
{ return mTempFile.file(); }
QTextStream *textStream()
{ return mTempFile.textStream(); }
QDataStream *dataStream()
{ return mTempFile.dataStream(); }
void abort();
bool close();
static bool backupFile( const QString& filename,
const QString& backupDir = QString::null,
const QString& backupExtension = QString::fromLatin1( "~" ) );
private:
QString mFileName;
KTempFile mTempFile;
KSaveFilePrivate *d;
};
#endif
KSaveFile::status
int status() const
Returns the status of the file based on errno.
Definition: ksavefile.h:68
KSaveFile::handle
int handle() const
An integer file descriptor open for writing to the file.
Definition: ksavefile.h:83
KSaveFile
The KSaveFile class has been made to write out changes to an existing file atomically.
Definition: ksavefile.h:41
KSaveFile::dataStream
QDataStream * dataStream()
A QDataStream* open for writing to the file.
Definition: ksavefile.h:115
KSaveFile::fstream
FILE * fstream()
A FILE* stream open for writing to the file.
Definition: ksavefile.h:91
KSaveFile::textStream
QTextStream * textStream()
A QTextStream* open for writing to the file.
Definition: ksavefile.h:107
KSaveFile::file
QFile * file()
A QFile* open for writing to the file.
Definition: ksavefile.h:99
KTempFile
The KTempFile class creates and opens a unique file for temporary use.
Definition: ktempfile.h:55

KDE Home | KDE Accessibility Home | Description of Access Keys