OLD | NEW |
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 26 matching lines...) Expand all Loading... |
37 bool done() const | 37 bool done() const |
38 { | 38 { |
39 return mPos >= mEnd; | 39 return mPos >= mEnd; |
40 } | 40 } |
41 | 41 |
42 String::size_type position() const | 42 String::size_type position() const |
43 { | 43 { |
44 return mPos - 1; | 44 return mPos - 1; |
45 } | 45 } |
46 | 46 |
| 47 void back() |
| 48 { |
| 49 if (mPos > 0) |
| 50 mPos--; |
| 51 } |
| 52 |
47 String::value_type next() | 53 String::value_type next() |
48 { | 54 { |
49 String::value_type result = done() ? mTerminator : mStr[mPos]; | 55 String::value_type result = done() ? mTerminator : mStr[mPos]; |
50 mPos++; | 56 mPos++; |
51 return result; | 57 return result; |
52 } | 58 } |
53 | 59 |
54 bool skipOne(String::value_type ch) | 60 bool skipOne(String::value_type ch) |
55 { | 61 { |
56 if (!done() && mStr[mPos] == ch) | 62 if (!done() && mStr[mPos] == ch) |
57 { | 63 { |
58 mPos++; | 64 mPos++; |
59 return true; | 65 return true; |
60 } | 66 } |
61 | 67 |
62 return false; | 68 return false; |
63 } | 69 } |
64 | 70 |
65 bool skip(String::value_type ch) | 71 bool skip(String::value_type ch) |
66 { | 72 { |
67 bool skipped = false; | 73 bool skipped = false; |
68 while ((skipped = skipOne(ch))); | 74 while ((skipped = skipOne(ch))); |
69 return skipped; | 75 return skipped; |
70 } | 76 } |
71 }; | 77 }; |
72 | 78 |
73 ABP_NS_END | 79 ABP_NS_END |
OLD | NEW |