• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

  • tdecore
tdetempfile.h
1 /*
2  This file is part of the KDE libraries
3  Copyright (c) 1999 Waldo Bastian <bastian@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef _TDETEMPFILE_H_
21 #define _TDETEMPFILE_H_
22 
23 #include <tqstring.h>
24 #include <stdio.h>
25 #include <errno.h>
26 #include "tdelibs_export.h"
27 
28 class TQFile;
29 class TQTextStream;
30 class TQDataStream;
31 class KSaveFile;
32 class KTempFilePrivate;
33 
55 class TDECORE_EXPORT KTempFile
56 {
57  friend class KSaveFile;
58 public:
71  KTempFile(TQString filePrefix=TQString::null,
72  TQString fileExtension=TQString::null,
73  int mode = 0600 );
74 
75 
80  ~KTempFile();
81 
87  void setAutoDelete(bool autoDelete) { bAutoDelete = autoDelete; }
88 
100  int status() const;
101 
122  TQString name() const;
123 
129  int handle() const;
130 
136  FILE *fstream();
137 
143  TQTextStream *textStream();
144 
150  TQDataStream *dataStream();
151 
157  TQFile *file();
158 
163  void unlink();
164 
175  bool sync();
176 
183  bool close();
184 
185 protected:
189  KTempFile(bool);
190 
195  bool create(const TQString &filePrefix,
196  const TQString &fileExtension, int mode);
197 
198  void setError(int error) { mError = error; }
199 private:
200  int mError;
201  TQString mTmpName;
202  int mFd;
203  FILE *mStream;
204  TQFile *mFile;
205  TQTextStream *mTextStream;
206  TQDataStream *mDataStream;
207  bool bOpen;
208  bool bAutoDelete;
209 
210  KTempFilePrivate *d;
211 };
212 
213 #endif
KSaveFile::status
int status() const
Returns the status of the file based on errno.
Definition: ksavefile.h:68
KSaveFile::textStream
TQTextStream * textStream()
A TQTextStream* open for writing to the file.
Definition: ksavefile.h:107
KSaveFile::handle
int handle() const
An integer file descriptor open for writing to the file.
Definition: ksavefile.h:83
KTempFile::setAutoDelete
void setAutoDelete(bool autoDelete)
Turn automatic deletion on or off.
Definition: tdetempfile.h:87
KSaveFile
The KSaveFile class has been made to write out changes to an existing file atomically.
Definition: ksavefile.h:41
KSaveFile::fstream
FILE * fstream()
A FILE* stream open for writing to the file.
Definition: ksavefile.h:91
KSaveFile::close
bool close()
Closes the file and makes the changes definitive.
Definition: ksavefile.cpp:107
KTempFile
The KTempFile class creates and opens a unique file for temporary use.
Definition: tdetempfile.h:55
KSaveFile::dataStream
TQDataStream * dataStream()
A TQDataStream* open for writing to the file.
Definition: ksavefile.h:115
KSaveFile::name
TQString name() const
The name of the file as passed to the constructor.
Definition: ksavefile.cpp:94
KSaveFile::file
TQFile * file()
A TQFile* open for writing to the file.
Definition: ksavefile.h:99

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.8.8
This website is maintained by Timothy Pearson.