diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-02-09 17:28:52 +0100 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-02-09 17:28:52 +0100 |
commit | 5d156c7a47ae5a743d6245965ffc932301f8a3bd (patch) | |
tree | ccab8aaf9b93ebc2f1a0c8cd09814f1531a06dae /src/core/common/CharReader.hpp | |
parent | bb8c69fbdeba3fa95fc780552252525b222ceb5a (diff) |
Added fetch and fetchPeek functions for reading the current character without advancing any cursor
Diffstat (limited to 'src/core/common/CharReader.hpp')
-rw-r--r-- | src/core/common/CharReader.hpp | 20 |
1 files changed, 20 insertions, 0 deletions
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 @@ -490,6 +490,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. * |