OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 } | 69 } |
70 | 70 |
71 template <typename CharType> | 71 template <typename CharType> |
72 void skipUntil(const CharType*& position, const CharType* end, CharType delimite r) | 72 void skipUntil(const CharType*& position, const CharType* end, CharType delimite r) |
73 { | 73 { |
74 while (position < end && *position != delimiter) | 74 while (position < end && *position != delimiter) |
75 ++position; | 75 ++position; |
76 } | 76 } |
77 | 77 |
78 template<typename CharType, bool characterPredicate(CharType)> | 78 template<typename CharType, bool characterPredicate(CharType)> |
79 void skipUntil(const CharType*& position, const CharType* end, CharType delimite r) | |
Mike West
2015/02/02 13:14:54
Hrm. this is somewhat strange. Why can't you fold
| |
80 { | |
81 while (position < end && !characterPredicate(*position) && *position != deli miter) | |
82 ++position; | |
83 } | |
84 | |
85 template<typename CharType, bool characterPredicate(CharType)> | |
79 void skipUntil(const CharType*& position, const CharType* end) | 86 void skipUntil(const CharType*& position, const CharType* end) |
80 { | 87 { |
81 while (position < end && !characterPredicate(*position)) | 88 while (position < end && !characterPredicate(*position)) |
82 ++position; | 89 ++position; |
83 } | 90 } |
84 | 91 |
85 template<typename CharType, bool characterPredicate(CharType)> | 92 template<typename CharType, bool characterPredicate(CharType)> |
86 void skipWhile(const CharType*& position, const CharType* end) | 93 void skipWhile(const CharType*& position, const CharType* end) |
87 { | 94 { |
88 while (position < end && characterPredicate(*position)) | 95 while (position < end && characterPredicate(*position)) |
89 ++position; | 96 ++position; |
90 } | 97 } |
91 | 98 |
92 template<typename CharType, bool characterPredicate(CharType)> | 99 template<typename CharType, bool characterPredicate(CharType)> |
93 void reverseSkipWhile(const CharType*& position, const CharType* start) | 100 void reverseSkipWhile(const CharType*& position, const CharType* start) |
94 { | 101 { |
95 while (position >= start && characterPredicate(*position)) | 102 while (position >= start && characterPredicate(*position)) |
96 --position; | 103 --position; |
97 } | 104 } |
98 | 105 |
99 #endif | 106 #endif |
100 | 107 |
OLD | NEW |