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

Side by Side Diff: compiled/StringScanner.h

Issue 29606600: Issue 5146 - Implement DownloadableSubscription parsing in C++ (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Nov. 13, 2017, 10:25 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
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 23 matching lines...) Expand all
34 bool done() const 34 bool done() const
35 { 35 {
36 return mPos >= mEnd; 36 return mPos >= mEnd;
37 } 37 }
38 38
39 String::size_type position() const 39 String::size_type position() const
40 { 40 {
41 return mPos - 1; 41 return mPos - 1;
42 } 42 }
43 43
44 void back()
45 {
46 if (mPos > 0)
47 mPos--;
48 }
49
44 String::value_type next() 50 String::value_type next()
45 { 51 {
46 String::value_type result = done() ? mTerminator : mStr[mPos]; 52 String::value_type result = done() ? mTerminator : mStr[mPos];
47 mPos++; 53 mPos++;
48 return result; 54 return result;
49 } 55 }
50 56
51 bool skipOne(String::value_type ch) 57 bool skipOne(String::value_type ch)
52 { 58 {
53 if (!done() && mStr[mPos] == ch) 59 if (!done() && mStr[mPos] == ch)
54 { 60 {
55 mPos++; 61 mPos++;
56 return true; 62 return true;
57 } 63 }
58 64
59 return false; 65 return false;
60 } 66 }
61 67
62 bool skip(String::value_type ch) 68 bool skip(String::value_type ch)
63 { 69 {
64 bool skipped = false; 70 bool skipped = false;
65 while ((skipped = skipOne(ch))); 71 while ((skipped = skipOne(ch)));
66 return skipped; 72 return skipped;
67 } 73 }
68 }; 74 };
OLDNEW

Powered by Google App Engine
This is Rietveld