diff options
author | Kenneth Heafield <github@kheafield.com> | 2013-01-05 01:02:47 +0400 |
---|---|---|
committer | Kenneth Heafield <github@kheafield.com> | 2013-01-05 01:02:47 +0400 |
commit | f9ee7ae4b3225a132d5abed20e38b0ff2bceb314 (patch) | |
tree | 7bec71a844c235cf34b18903d6fbd314fe1fb60f /util/file_piece.hh | |
parent | 3203f7c92d97181d5f7d293be66873d2865d9209 (diff) |
KenLM 0e5d259 including read_compressed fix
Diffstat (limited to 'util/file_piece.hh')
-rw-r--r-- | util/file_piece.hh | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/util/file_piece.hh b/util/file_piece.hh index 53e0b1061..39bd15811 100644 --- a/util/file_piece.hh +++ b/util/file_piece.hh @@ -23,17 +23,17 @@ class ParseNumberException : public Exception { extern const bool kSpaces[256]; -// Memory backing the returned StringPiece may vanish on the next call. +// Memory backing the returned StringPiece may vanish on the next call. class FilePiece { public: // 1 MB default. explicit FilePiece(const char *file, std::ostream *show_progress = NULL, std::size_t min_buffer = 1048576); - // Takes ownership of fd. name is used for messages. + // Takes ownership of fd. name is used for messages. explicit FilePiece(int fd, const char *name, std::ostream *show_progress = NULL, std::size_t min_buffer = 1048576); ~FilePiece(); - - char get() { + + char get() { if (position_ == position_end_) { Shift(); if (at_end_) throw EndOfFileException(); @@ -41,14 +41,14 @@ class FilePiece { return *(position_++); } - // Leaves the delimiter, if any, to be returned by get(). Delimiters defined by isspace(). + // Leaves the delimiter, if any, to be returned by get(). Delimiters defined by isspace(). StringPiece ReadDelimited(const bool *delim = kSpaces) { SkipSpaces(delim); return Consume(FindDelimiterOrEOF(delim)); } // Unlike ReadDelimited, this includes leading spaces and consumes the delimiter. - // It is similar to getline in that way. + // It is similar to getline in that way. StringPiece ReadLine(char delim = '\n'); float ReadFloat(); @@ -56,7 +56,7 @@ class FilePiece { long int ReadLong(); unsigned long int ReadULong(); - // Skip spaces defined by isspace. + // Skip spaces defined by isspace. void SkipSpaces(const bool *delim = kSpaces) { for (; ; ++position_) { if (position_ == position_end_) Shift(); @@ -69,7 +69,7 @@ class FilePiece { } const std::string &FileName() const { return file_name_; } - + private: void Initialize(const char *name, std::ostream *show_progress, std::size_t min_buffer); |