aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/fs/io/TextFile.cxx8
-rw-r--r--src/fs/io/TextFile.hxx8
2 files changed, 16 insertions, 0 deletions
diff --git a/src/fs/io/TextFile.cxx b/src/fs/io/TextFile.cxx
index 5b3bc4505..28d6dabcb 100644
--- a/src/fs/io/TextFile.cxx
+++ b/src/fs/io/TextFile.cxx
@@ -61,3 +61,11 @@ TextFile::ReadLine()
return buffered_reader->ReadLine();
}
+
+bool
+TextFile::Check(Error &error) const
+{
+ assert(buffered_reader != nullptr);
+
+ return buffered_reader->Check(error);
+}
diff --git a/src/fs/io/TextFile.hxx b/src/fs/io/TextFile.hxx
index 8bab808c7..5577363e7 100644
--- a/src/fs/io/TextFile.hxx
+++ b/src/fs/io/TextFile.hxx
@@ -56,10 +56,18 @@ public:
* space. There is a reasonable maximum line length, only to
* prevent denial of service.
*
+ * Use Check() after nullptr has been returned to check
+ * whether an error occurred or end-of-file has been reached.
+ *
* @param file the source file, opened in text mode
* @return a pointer to the line, or nullptr on end-of-file or error
*/
char *ReadLine();
+
+ /**
+ * Check whether a ReadLine() call has thrown an error.
+ */
+ bool Check(Error &error) const;
};
#endif