summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/unicode.h
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2010-12-16 15:56:14 +0100
committerAdam Borowski <kilobyte@angband.pl>2010-12-16 16:53:03 +0100
commitad3bbac308f31e2c8bef95e921152f34f00cc785 (patch)
tree8315917941e95878b6788b17603ecabbbd39df1c /crawl-ref/source/unicode.h
parentc182b846613a797cb37fcda578553e40814b7e65 (diff)
downloadcrawl-ref-ad3bbac308f31e2c8bef95e921152f34f00cc785.tar.gz
crawl-ref-ad3bbac308f31e2c8bef95e921152f34f00cc785.zip
Rename TextFileReader to FileLineInput I didn't notice, use it for config files.
Diffstat (limited to 'crawl-ref/source/unicode.h')
-rw-r--r--crawl-ref/source/unicode.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/crawl-ref/source/unicode.h b/crawl-ref/source/unicode.h
index 5de066ea99..4e0ffa206a 100644
--- a/crawl-ref/source/unicode.h
+++ b/crawl-ref/source/unicode.h
@@ -4,6 +4,8 @@
* manipulation functions that act on character types.
* Written by: Adam Borowski
*/
+#ifndef UNICODE_H
+#define UNICODE_H
int wctoutf8(char *d, ucs_t s);
int utf8towc(ucs_t *d, const char *s);
@@ -25,7 +27,16 @@ static inline std::string mb_to_utf8(const std::string &s)
#define OUTS(x) utf8_to_mb(x).c_str()
-class TextFileReader
+class LineInput
+{
+public:
+ virtual ~LineInput() {}
+ virtual bool eof() = 0;
+ virtual bool error() { return false; };
+ virtual std::string get_line() = 0;
+};
+
+class FileLineInput : public LineInput
{
enum bom_type
{
@@ -40,9 +51,11 @@ class TextFileReader
bom_type bom;
bool seen_eof;
public:
- TextFileReader(const char *name);
- ~TextFileReader();
- bool eof() { return seen_eof; };
+ FileLineInput(const char *name);
+ ~FileLineInput();
+ bool eof() { return seen_eof || !f; };
bool error() { return !f; };
std::string get_line();
};
+
+#endif