diff options
author | Max Kellermann <max@duempel.org> | 2013-10-01 18:31:22 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-10-02 08:56:27 +0200 |
commit | c53492a76a8a05825e1c7f699c05645eee891199 (patch) | |
tree | 55919615a5b94c9494dcf73711554c4ecfee5f91 | |
parent | 43675717b83b8502dcf7a2254195f771c50d8cec (diff) |
TextFile: don't include glib.h in header
Un-inline the methods that use GLib.
-rw-r--r-- | src/TextFile.cxx | 16 | ||||
-rw-r--r-- | src/TextFile.hxx | 18 |
2 files changed, 22 insertions, 12 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() { diff --git a/src/TextFile.hxx b/src/TextFile.hxx index d593e0961..6aff4ca70 100644 --- a/src/TextFile.hxx +++ b/src/TextFile.hxx @@ -21,10 +21,11 @@ #define MPD_TEXT_FILE_HXX #include "gcc.h" -#include "fs/Path.hxx" -#include "fs/FileSystem.hxx" -#include <glib.h> +#include <stdio.h> + +class Path; +typedef struct _GString GString; class TextFile { static constexpr size_t max_length = 512 * 1024; @@ -35,18 +36,11 @@ class TextFile { GString *const buffer; public: - TextFile(const Path &path_fs) - :file(FOpen(path_fs, FOpenMode::ReadText)), - buffer(g_string_sized_new(step)) {} + TextFile(const Path &path_fs); TextFile(const TextFile &other) = delete; - ~TextFile() { - if (file != nullptr) - fclose(file); - - g_string_free(buffer, true); - } + ~TextFile(); bool HasFailed() const { return gcc_unlikely(file == nullptr); |