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

kdecore

  • kdecore
ksavefile.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 _KSAVEFILE_H_
21 #define _KSAVEFILE_H_
22 
23 #include <tqstring.h>
24 #include <stdio.h>
25 #include <errno.h>
26 #include <ktempfile.h>
27 
28 class KSaveFilePrivate;
29 
41 class KDECORE_EXPORT KSaveFile
42 {
43 public:
49  KSaveFile(const TQString &filename, int mode = 0666 );
50 
55  ~KSaveFile();
56 
68  int status() const
69  { return mTempFile.status(); }
70 
76  TQString name() const;
77 
83  int handle() const
84  { return mTempFile.handle(); }
85 
91  FILE *fstream()
92  { return mTempFile.fstream(); }
93 
99  TQFile *file()
100  { return mTempFile.file(); }
101 
107  TQTextStream *textStream()
108  { return mTempFile.textStream(); }
109 
115  TQDataStream *dataStream()
116  { return mTempFile.dataStream(); }
117 
122  void abort();
123 
130  bool close();
131 
141  static bool backupFile( const TQString& filename,
142  const TQString& backupDir = TQString::null,
143  const TQString& backupExtension = TQString::fromLatin1( "~" ) );
144 
145 private:
146  TQString mFileName;
147  KTempFile mTempFile;
148 
149  KSaveFilePrivate *d;
150 };
151 
152 #endif
KSaveFile
The KSaveFile class has been made to write out changes to an existing file atomically.
Definition: ksavefile.h:42
KSaveFile::status
int status() const
Returns the status of the file based on errno.
Definition: ksavefile.h:68
KSaveFile::fstream
FILE * fstream()
A FILE* stream open for writing to the file.
Definition: ksavefile.h:91
KSaveFile::file
TQFile * file()
A TQFile* open for writing to the file.
Definition: ksavefile.h:99
KSaveFile::dataStream
TQDataStream * dataStream()
A TQDataStream* open for writing to the file.
Definition: ksavefile.h:115
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
The KTempFile class creates and opens a unique file for temporary use.
Definition: ktempfile.h:56

kdecore

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

kdecore

Skip menu "kdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdecore by doxygen 1.9.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |