From 5d156c7a47ae5a743d6245965ffc932301f8a3bd Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Mon, 9 Feb 2015 17:28:52 +0100 Subject: Added fetch and fetchPeek functions for reading the current character without advancing any cursor --- src/core/common/CharReader.hpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/core/common/CharReader.hpp') diff --git a/src/core/common/CharReader.hpp b/src/core/common/CharReader.hpp index 64c80af..a90d337 100644 --- a/src/core/common/CharReader.hpp +++ b/src/core/common/CharReader.hpp @@ -489,6 +489,26 @@ public: */ bool read(char &c); + /** + * Returns the current character at the read cursor without advancing it. + * + * @param c is a reference to the character into which the result should be + * written. + * @return true if the operation was successful, false if the cursor is at + * the end of the file. + */ + bool fetch(char &c); + + /** + * Returns the current character at the peek cursor without advancing it. + * + * @param c is a reference to the character into which the result should be + * written. + * @return true if the operation was successful, false if the cursor is at + * the end of the file. + */ + bool fetchPeek(char &c); + /** * Peeks a character, checks whether this character equals the given * character -- and if yes -- consumes the peek, otherwise resets it. -- cgit v1.2.3