summaryrefslogtreecommitdiff
path: root/src/core/common/CharReader.hpp
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-24 03:07:00 +0100
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-24 03:07:00 +0100
commit4c5ecbe39bf17ebd1c663c863cef5094f53caf86 (patch)
treef02551371b0cdd0563136ba22d831781d01afc91 /src/core/common/CharReader.hpp
parentfcdc9e28805138383c6ef662ea5e3822720b772c (diff)
Added seek function to CharReader, improved getOffset
Diffstat (limited to 'src/core/common/CharReader.hpp')
-rw-r--r--src/core/common/CharReader.hpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/core/common/CharReader.hpp b/src/core/common/CharReader.hpp
index 5a4d906..cbd7b74 100644
--- a/src/core/common/CharReader.hpp
+++ b/src/core/common/CharReader.hpp
@@ -297,8 +297,7 @@ public:
* @param relativeOffs is a positive or negative integer number specifying
* the number of bytes the cursor should be moved forward (positive numbers)
* or backwards (negative numbers).
- * @return the actual number of bytes the cursor was moved. This number is
- * smaller than the relativeOffs given in the constructor if the
+ * @return the actual number of bytes the cursor was moved.
*/
ssize_t moveCursor(CursorId cursor, ssize_t relativeOffs);
@@ -523,6 +522,17 @@ public:
size_t readRaw(char *buf, size_t size);
/**
+ * Moves read and peek cursor to the requested offset. Returns the offset
+ * that was 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 seek(size_t requestedOffset);
+
+ /**
* Returns true if there are no more characters as the stream was closed.
*
* @return true if there is no more data.
@@ -534,14 +544,14 @@ public:
*
* @return the offset of the read cursor in bytes.
*/
- SourceOffset getOffset() const;
+ size_t getOffset() const;
/**
- * Returns the offset of the read cursor in bytes.
+ * Returns the offset of the peek cursor in bytes.
*
- * @return the offset of the read cursor in bytes.
+ * @return the offset of the peek cursor in bytes.
*/
- SourcePosition getPosition() const;
+ size_t getPeekOffset() const;
/**
* Returns a SourceLocation object describing the exact position (including