commit 210c64549d4f69b5ac415c649f74525078afa285 Author: Daniel Swanson Date: Fri Jun 11 18:40:27 2021 -0500 another helper (rather than define this in every repo) diff --git a/lttoolbox/input_file.cc b/lttoolbox/input_file.cc index d0a150b..64ab460 100644 --- a/lttoolbox/input_file.cc +++ b/lttoolbox/input_file.cc @@ -144,3 +144,19 @@ InputFile::rewind() } } } + +UString +InputFile::readBlock(const UChar32 start, const UChar32 end) +{ + UString ret; + ret += start; + UChar32 c = 0; + while (c != end && !eof()) { + c = get(); + ret += c; + if (c == '\\') { + ret += get(); + } + } + return ret; +} diff --git a/lttoolbox/input_file.h b/lttoolbox/input_file.h index 9cabc64..5f8dce0 100644 --- a/lttoolbox/input_file.h +++ b/lttoolbox/input_file.h @@ -20,6 +20,7 @@ #include #include +#include class InputFile { @@ -40,6 +41,7 @@ public: void unget(UChar32 c); bool eof(); void rewind(); + UString readBlock(const UChar32 start, const UChar32 end); }; #endif