Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: compiled/StringScanner.h

Issue 29333474: Issue 4125 - [emscripten] Convert filter classes to C++ (Closed)
Patch Set: How with CSS property filters Created Jan. 20, 2016, 1:12 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « compiled/RegExpFilter.cpp ('k') | compiled/WhiteListFilter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « compiled/RegExpFilter.cpp ('k') | compiled/WhiteListFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld