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

Side by Side Diff: compiled/StringScanner.h

Issue 29333474: Issue 4125 - [emscripten] Convert filter classes to C++ (Closed)
Patch Set: Call parameters in JS wrappers generated statically Created Jan. 28, 2016, 9:26 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « compiled/StringMap.h ('k') | compiled/WhitelistFilter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #ifndef ADBLOCK_PLUS_STRING_SCANNER_H
2 #define ADBLOCK_PLUS_STRING_SCANNER_H
3
4 #include "String.h"
5
6 class StringScanner
7 {
8 private:
9 String mStr;
10 String::size_type mPos;
11 String::size_type mEnd;
12 String::value_type mTerminator;
13 public:
14 StringScanner(const String& str, String::value_type terminator = u'\0')
15 : mStr(str), mPos(0), mEnd(str.length()), mTerminator(terminator) {}
16
17 bool done()
18 {
19 return mPos >= mEnd;
20 }
21
22 String::size_type position()
23 {
24 return mPos - 1;
25 }
26
27 String::value_type next()
28 {
29 String::value_type result = done() ? mTerminator : mStr[mPos];
30 mPos++;
31 return result;
32 }
33 };
34
35 #endif
OLDNEW
« no previous file with comments | « compiled/StringMap.h ('k') | compiled/WhitelistFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld