Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ParsingUtilities_h | |
| 6 #define ParsingUtilities_h | |
| 7 | |
| 8 template<typename CharType> | |
| 9 bool skipExactly(const CharType*& position, const CharType* end, CharType delimi ter) | |
| 10 { | |
| 11 if (position < end && *position == delimiter) { | |
| 12 ++position; | |
| 13 return true; | |
| 14 } | |
| 15 return false; | |
| 16 } | |
| 17 | |
| 18 template<typename CharType, bool characterPredicate(CharType)> | |
|
cbiesinger
2013/09/19 23:01:44
Couldn't you make CharType the second template arg
abarth-chromium
2013/09/20 16:08:07
+1
| |
| 19 bool skipExactly(const CharType*& position, const CharType* end) | |
| 20 { | |
| 21 if (position < end && characterPredicate(*position)) { | |
| 22 ++position; | |
| 23 return true; | |
| 24 } | |
| 25 return false; | |
| 26 } | |
| 27 | |
| 28 template<typename CharType> | |
| 29 void skipUntil(const CharType*& position, const CharType* end, CharType delimite r) | |
| 30 { | |
| 31 while (position < end && *position != delimiter) | |
| 32 ++position; | |
| 33 } | |
| 34 | |
| 35 template<typename CharType, bool characterPredicate(CharType)> | |
| 36 void skipUntil(const CharType*& position, const CharType* end) | |
| 37 { | |
| 38 while (position < end && !characterPredicate(*position)) | |
| 39 ++position; | |
| 40 } | |
| 41 | |
| 42 template<typename CharType, bool characterPredicate(CharType)> | |
| 43 void skipWhile(const CharType*& position, const CharType* end) | |
| 44 { | |
| 45 while (position < end && characterPredicate(*position)) | |
| 46 ++position; | |
| 47 } | |
| 48 | |
| 49 #endif | |
| 50 | |
| OLD | NEW |