From fb0922e57f1a5e1fb8bfbe153dc381d5778e3137 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Sun, 8 Feb 2015 17:53:15 +0100 Subject: Added seekPeekCursor function to CharReader, improved how seeking is handled by adding seekCursor method to Buffer --- 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 cbd7b74..cbfeaf2 100644 --- a/src/core/common/CharReader.hpp +++ b/src/core/common/CharReader.hpp @@ -301,6 +301,15 @@ public: */ ssize_t moveCursor(CursorId cursor, ssize_t relativeOffs); + /** + * Moves the cursor to the given position. + * + * @param cursor is the cursor that should be moved. + * @param offs is the offset to which the cursor should be moved. + * @return the actual location that was reached. + */ + size_t seekCursor(CursorId cursor, size_t offs); + /** * Returns the current byte offset of the given cursor relative to the * beginning of the stream. @@ -532,6 +541,17 @@ public: */ size_t seek(size_t requestedOffset); + /** + * Moves the peek cursor to the requested offset. Returns the offse that wa + * actually reached. + * + * @param requestedOffset is the requested offset. This offset may no longer + * be reachable by the CharReader. + * @return the actually reached offset. The operation was successful, if + * the requested and reached offset are equal. + */ + size_t seekPeekCursor(size_t requestedOffset); + /** * Returns true if there are no more characters as the stream was closed. * -- cgit v1.2.3