diff options
author | Adam Borowski <kilobyte@angband.pl> | 2011-01-11 13:03:13 +0100 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2011-01-11 13:03:13 +0100 |
commit | e7c3fa432cecc5eeb49d79109033fd85ee3cad2a (patch) | |
tree | fe057b8382c66ffccbd6c6a01ce3286b691c2135 /crawl-ref/source/tags.h | |
parent | e5001fba77867a842c1b0b192ec6969aab1cf102 (diff) | |
parent | cc071d90f3d21a23526d1f92d055835e3d370d73 (diff) | |
download | crawl-ref-e7c3fa432cecc5eeb49d79109033fd85ee3cad2a.tar.gz crawl-ref-e7c3fa432cecc5eeb49d79109033fd85ee3cad2a.zip |
Merge branch 'master' into unicode
Conflicts galore...
Diffstat (limited to 'crawl-ref/source/tags.h')
-rw-r--r-- | crawl-ref/source/tags.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/crawl-ref/source/tags.h b/crawl-ref/source/tags.h index c9b0b6b0ec..3be306f05c 100644 --- a/crawl-ref/source/tags.h +++ b/crawl-ref/source/tags.h @@ -154,26 +154,31 @@ void marshallSigned(writer& th, int64_t v); class reader { public: - reader(const std::string &filename, int minorVersion = TAG_MINOR_VERSION); - reader(FILE* input, int minorVersion = TAG_MINOR_VERSION) + reader(const std::string &filename, int minorVersion = TAG_MINOR_INVALID); + reader(FILE* input, int minorVersion = TAG_MINOR_INVALID) : _file(input), _chunk(0), opened_file(false), _pbuf(0), _read_offset(0), _minorVersion(minorVersion) {} reader(const std::vector<unsigned char>& input, - int minorVersion = TAG_MINOR_VERSION) + int minorVersion = TAG_MINOR_INVALID) : _file(0), _chunk(0), opened_file(false), _pbuf(&input), _read_offset(0), _minorVersion(minorVersion) {} reader(package *save, const std::string &chunkname, - int minorVersion = TAG_MINOR_VERSION); + int minorVersion = TAG_MINOR_INVALID); ~reader(); unsigned char readByte(); void read(void *data, size_t size); void advance(size_t size); - int getMinorVersion(); + int getMinorVersion() const; + void setMinorVersion(int minorVersion); bool valid() const; - void fail_if_not_eof(const std::string name); + void fail_if_not_eof(const std::string &name); + void close(); + + std::string filename() const { return _filename; } private: + std::string _filename; FILE* _file; chunk_reader *_chunk; bool opened_file; @@ -227,7 +232,7 @@ static inline void unmarshallSigned(reader& th, T& v) * Tag interface * *********************************************************************** */ -void tag_read(reader &inf, int minorVersion, tag_type tag_id); +void tag_read(reader &inf, tag_type tag_id); void tag_write(tag_type tagID, writer &outf); /* *********************************************************************** |