Index: compiled/StringScanner.h |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/compiled/StringScanner.h |
@@ -0,0 +1,31 @@ |
+#ifndef ADBLOCK_PLUS_STRING_SCANNER_H |
+#define ADBLOCK_PLUS_STRING_SCANNER_H |
+ |
+#include <string> |
+ |
+class StringScanner |
+{ |
+private: |
+ const std::u16string str; |
+ size_t pos; |
+ size_t end; |
+public: |
+ StringScanner(const std::u16string& str) : str(str), pos(0), end(str.length()) {} |
+ |
+ bool done() |
+ { |
+ return pos >= end; |
+ } |
+ |
+ size_t position() |
+ { |
+ return pos - 1; |
+ } |
+ |
+ char16_t next() |
+ { |
+ return done() ? u'\0' : str[pos++]; |
+ } |
+}; |
+ |
+#endif |