KDE3Support
k3tempfile.h
Go to the documentation of this file.
00001 /* 00002 This file is part of the KDE libraries 00003 Copyright (c) 1999 Waldo Bastian <bastian@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License version 2 as published by the Free Software Foundation. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef K3TEMPFILE_H 00021 #define K3TEMPFILE_H 00022 00023 #include <kde3support_export.h> 00024 #include <QtCore/QString> 00025 #include <stdio.h> 00026 00027 class QFile; 00028 class QTextStream; 00029 class QDataStream; 00030 class KSaveFile; 00031 00055 class KDE3SUPPORT_EXPORT K3TempFile 00056 { 00057 friend class KSaveFile; 00058 public: 00071 explicit K3TempFile(const QString& filePrefix=QString(), 00072 const QString& fileExtension=QString(), 00073 int mode = 0600 ); 00074 00079 ~K3TempFile(); 00080 00086 void setAutoDelete(bool autoDelete); 00087 00099 int status() const; 00100 00122 QString name() const; 00123 00129 int handle() const; 00130 00136 FILE *fstream(); 00137 00143 QTextStream *textStream(); 00144 00150 QDataStream *dataStream(); 00151 00157 QFile *file(); 00158 00163 void unlink(); 00164 00174 bool sync(); 00175 00182 bool close(); 00183 00184 protected: 00188 explicit K3TempFile(bool); 00189 00197 bool create(const QString &filePrefix, 00198 const QString &fileExtension, int mode); 00199 00207 void setError(int error); 00213 bool isOpen() const; 00214 private: 00215 00216 Q_DISABLE_COPY(K3TempFile) 00217 00218 class Private; 00219 Private * const d; 00220 }; 00221 00222 #endif
KDE 4.6 API Reference