diff options
author | Kenneth Heafield <github@kheafield.com> | 2014-06-02 21:28:02 +0400 |
---|---|---|
committer | Kenneth Heafield <github@kheafield.com> | 2014-06-02 21:29:40 +0400 |
commit | dd03f9fb69da82a37f1846d25dcc8d8781956e96 (patch) | |
tree | 12df06240d6149f110982d1f76c9addf40acbce1 /util/file_piece.cc | |
parent | 31a583b0bc322626356a42965f02534249070525 (diff) |
KenLM 5a7efd8fe1db88ee0a9f7e9479b24ac3ca348221 with Hieu's patch to exception.hh
Diffstat (limited to 'util/file_piece.cc')
-rw-r--r-- | util/file_piece.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/util/file_piece.cc b/util/file_piece.cc index 9c7e00c4c..4aaa250e3 100644 --- a/util/file_piece.cc +++ b/util/file_piece.cc @@ -84,6 +84,13 @@ StringPiece FilePiece::ReadLine(char delim) { } } +bool FilePiece::ReadLineOrEOF(StringPiece &to, char delim) { + try { + to = ReadLine(delim); + } catch (const util::EndOfFileException &e) { return false; } + return true; +} + float FilePiece::ReadFloat() { return ReadNumber<float>(); } |