aboutsummaryrefslogtreecommitdiffstats
path: root/src/TextFile.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-01 18:31:22 +0200
committerMax Kellermann <max@duempel.org>2013-10-02 08:56:27 +0200
commitc53492a76a8a05825e1c7f699c05645eee891199 (patch)
tree55919615a5b94c9494dcf73711554c4ecfee5f91 /src/TextFile.cxx
parent43675717b83b8502dcf7a2254195f771c50d8cec (diff)
downloadmpd-c53492a76a8a05825e1c7f699c05645eee891199.tar.gz
mpd-c53492a76a8a05825e1c7f699c05645eee891199.tar.xz
mpd-c53492a76a8a05825e1c7f699c05645eee891199.zip
TextFile: don't include glib.h in header
Un-inline the methods that use GLib.
Diffstat (limited to '')
-rw-r--r--src/TextFile.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/TextFile.cxx b/src/TextFile.cxx
index 4ad59ee4a..da0b33816 100644
--- a/src/TextFile.cxx
+++ b/src/TextFile.cxx
@@ -19,10 +19,26 @@
#include "config.h"
#include "TextFile.hxx"
+#include "fs/Path.hxx"
+#include "fs/FileSystem.hxx"
+
+#include <glib.h>
#include <assert.h>
#include <string.h>
+TextFile::TextFile(const Path &path_fs)
+ :file(FOpen(path_fs, FOpenMode::ReadText)),
+ buffer(g_string_sized_new(step)) {}
+
+TextFile::~TextFile()
+{
+ if (file != nullptr)
+ fclose(file);
+
+ g_string_free(buffer, true);
+}
+
char *
TextFile::ReadLine()
{