summaryrefslogtreecommitdiff
path: root/src/positions.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/positions.h')
-rw-r--r--src/positions.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/positions.h b/src/positions.h
index 88d9584..1c883a4 100644
--- a/src/positions.h
+++ b/src/positions.h
@@ -31,6 +31,7 @@
class Positions
{
friend class PositionIterator;
+ friend class PositionReverseIterator;
public:
/* Denotes the last char of a keyword, depending on the keyword's length. */
enum { LASTCHAR = 0 };
@@ -99,6 +100,26 @@ private:
unsigned int _index;
};
+/* This class denotes an iterator in reverse direction through a set of
+ byte positions. */
+
+class PositionReverseIterator
+{
+public:
+ /* Initializes an iterator through POSITIONS. */
+ PositionReverseIterator (Positions const& positions);
+
+ /* End of iteration marker. */
+ enum { EOS = -1 };
+
+ /* Retrieves the next position, or EOS past the end. */
+ int next ();
+
+private:
+ const Positions& _set;
+ unsigned int _index;
+};
+
#ifdef __OPTIMIZE__
#include <string.h>