aboutsummaryrefslogtreecommitdiffstats
path: root/src/fs/io/TextFile.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/io/TextFile.hxx')
-rw-r--r--src/fs/io/TextFile.hxx18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/fs/io/TextFile.hxx b/src/fs/io/TextFile.hxx
index e3a712a88..33a1b8060 100644
--- a/src/fs/io/TextFile.hxx
+++ b/src/fs/io/TextFile.hxx
@@ -22,29 +22,26 @@
#include "Compiler.h"
-#include <stdio.h>
#include <stddef.h>
class Path;
+class Error;
+class FileReader;
+class BufferedReader;
class TextFile {
- static constexpr size_t max_length = 512 * 1024;
- static constexpr size_t step = 1024;
-
- FILE *const file;
-
- char *buffer;
- size_t capacity, length;
+ FileReader *const file_reader;
+ BufferedReader *const buffered_reader;
public:
- TextFile(Path path_fs);
+ TextFile(Path path_fs, Error &error);
TextFile(const TextFile &other) = delete;
~TextFile();
bool HasFailed() const {
- return gcc_unlikely(file == nullptr);
+ return gcc_unlikely(buffered_reader == nullptr);
}
/**
@@ -53,7 +50,6 @@ public:
* prevent denial of service.
*
* @param file the source file, opened in text mode
- * @param buffer an allocator for the buffer
* @return a pointer to the line, or nullptr on end-of-file or error
*/
char *ReadLine();