summaryrefslogtreecommitdiffstats
path: root/kget/kfileio.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbcb704366cb5e333a626c18c308c7e0448a8e69f (patch)
treef0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /kget/kfileio.h
downloadtdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz
tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kget/kfileio.h')
-rw-r--r--kget/kfileio.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/kget/kfileio.h b/kget/kfileio.h
new file mode 100644
index 00000000..9b2780ad
--- /dev/null
+++ b/kget/kfileio.h
@@ -0,0 +1,44 @@
+/***************************************************************************
+* kfileio.h
+* -------------------
+*
+* Revision : $Id$
+* begin : Tue Jan 29 2002
+* copyright : (C) 2002 by Patrick Charbonnier
+*
+* email : pch@freeshell.org
+*
+***************************************************************************/
+
+/* Load / save entire (local) files with nice diagnostics dialog messages.
+ * These functions load/save the whole buffer in one i/o call, so they
+ * should be pretty efficient.
+ *
+ * Author: Stefan Taferner <taferner@kde.org>
+ * This code is under GPL.
+ */
+#ifndef kfileio_h
+#define kfileio_h
+
+/** Load a file. Returns a pointer to the memory-block that contains
+ * the loaded file. Returns a NULL string if the file could not be loaded.
+ * If withDialogs is FALSE no warning dialogs are opened if there are
+ * problems.
+ * The string returned is always zero-terminated and therefore one
+ * byte longer than the file itself.
+ * If ensureNewline is TRUE the string will always have a trailing newline.
+ */
+QString kFileToString(const QString & fileName, bool ensureNewline = TRUE, bool withDialogs = TRUE);
+
+/** Save a file. If withDialogs is FALSE no warning dialogs are opened if
+ * there are problems. Returns TRUE on success and FALSE on failure.
+ * Replaces existing files without warning if askIfExists==FALSE.
+ * Makes a copy if the file exists to filename~ if createBackup==TRUE.
+ */
+bool kCStringToFile(const QCString & buffer, const QString & fileName, bool askIfExists = FALSE, bool createBackup = TRUE, bool withDialogs = TRUE);
+
+// Does not stop at NUL
+bool kByteArrayToFile(const QByteArray & buffer, const QString & fileName, bool askIfExists = FALSE, bool createBackup = TRUE, bool withDialogs = TRUE);
+
+
+#endif /* kfileio_h */