#include "streams.h"
Go to the source code of this file.
Functions |
|
invisible_class (ReadonlyTextFileStream) class ReadonlyTextFileStream | |
ReadonlyTextFileStream is only used for
opening text file in read-only mode. |
invisible_class | ( | ReadonlyTextFileStream | ) |
ReadonlyTextFileStream is only used for opening text file in read-only mode.
It's equivalent to use FileStream when opening files in "rt" mode. But FileStream is very slow when reading files. So we optimize the original codes in FileStream and create this new class which is thousand times faster for reading text files than FileStream.
The default constructor.
The default destructor.
Open a new text file.
[in] | ifile_name | The file name. |
Definition at line 14 of file readonlytextfilestream.h.
: public CharStream { public: ScripterExport ReadonlyTextFileStream(); ScripterExport ~ReadonlyTextFileStream(); ScripterExport ReadonlyTextFileStream* open(const MCHAR* ifile_name); /* internal char stream protocol */ MCHAR get_char(); void unget_char(MCHAR c); MCHAR peek_char(); int at_eos(); unsigned int pos(); void seek(int pos); void rewind(); void flush_to_eol(); MCHAR putch(MCHAR c); const MCHAR* puts(const MCHAR* str); int printf(const MCHAR *format, ...); void collect(); void close(); void gc_trace(); void log_to(CharStream* log); void close_log(); CharStream* get_log(); private: void VerifyFileOpen() const; MCHAR CharAtPos(size_t pos); int mUngetcharCount; MCHAR mUngetcharBuf[8]; char* mFileBuf; size_t mCharCount; size_t mCharPos; CharStream* mLog; }