OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, Opera Software ASA. All rights reserved. | 2 * Copyright (c) 2013, Opera Software ASA. 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 template<unsigned charactersCount> | 160 template<unsigned charactersCount> |
161 inline bool VTTScanner::scan(const char (&characters)[charactersCount]) | 161 inline bool VTTScanner::scan(const char (&characters)[charactersCount]) |
162 { | 162 { |
163 return scan(reinterpret_cast<const LChar*>(characters), charactersCount - 1)
; | 163 return scan(reinterpret_cast<const LChar*>(characters), charactersCount - 1)
; |
164 } | 164 } |
165 | 165 |
166 template<bool characterPredicate(UChar)> | 166 template<bool characterPredicate(UChar)> |
167 inline void VTTScanner::skipWhile() | 167 inline void VTTScanner::skipWhile() |
168 { | 168 { |
169 if (m_is8Bit) | 169 if (m_is8Bit) |
170 ::skipWhile<LChar, LCharPredicateAdapter<characterPredicate> >(m_data.ch
aracters8, m_end.characters8); | 170 ::skipWhile<LChar, LCharPredicateAdapter<characterPredicate>>(m_data.cha
racters8, m_end.characters8); |
171 else | 171 else |
172 ::skipWhile<UChar, characterPredicate>(m_data.characters16, m_end.charac
ters16); | 172 ::skipWhile<UChar, characterPredicate>(m_data.characters16, m_end.charac
ters16); |
173 } | 173 } |
174 | 174 |
175 template<bool characterPredicate(UChar)> | 175 template<bool characterPredicate(UChar)> |
176 inline void VTTScanner::skipUntil() | 176 inline void VTTScanner::skipUntil() |
177 { | 177 { |
178 if (m_is8Bit) | 178 if (m_is8Bit) |
179 ::skipUntil<LChar, LCharPredicateAdapter<characterPredicate> >(m_data.ch
aracters8, m_end.characters8); | 179 ::skipUntil<LChar, LCharPredicateAdapter<characterPredicate>>(m_data.cha
racters8, m_end.characters8); |
180 else | 180 else |
181 ::skipUntil<UChar, characterPredicate>(m_data.characters16, m_end.charac
ters16); | 181 ::skipUntil<UChar, characterPredicate>(m_data.characters16, m_end.charac
ters16); |
182 } | 182 } |
183 | 183 |
184 template<bool characterPredicate(UChar)> | 184 template<bool characterPredicate(UChar)> |
185 inline VTTScanner::Run VTTScanner::collectWhile() | 185 inline VTTScanner::Run VTTScanner::collectWhile() |
186 { | 186 { |
187 if (m_is8Bit) { | 187 if (m_is8Bit) { |
188 const LChar* current = m_data.characters8; | 188 const LChar* current = m_data.characters8; |
189 ::skipWhile<LChar, LCharPredicateAdapter<characterPredicate> >(current,
m_end.characters8); | 189 ::skipWhile<LChar, LCharPredicateAdapter<characterPredicate>>(current, m
_end.characters8); |
190 return Run(position(), current, m_is8Bit); | 190 return Run(position(), current, m_is8Bit); |
191 } | 191 } |
192 const UChar* current = m_data.characters16; | 192 const UChar* current = m_data.characters16; |
193 ::skipWhile<UChar, characterPredicate>(current, m_end.characters16); | 193 ::skipWhile<UChar, characterPredicate>(current, m_end.characters16); |
194 return Run(position(), reinterpret_cast<Position>(current), m_is8Bit); | 194 return Run(position(), reinterpret_cast<Position>(current), m_is8Bit); |
195 } | 195 } |
196 | 196 |
197 template<bool characterPredicate(UChar)> | 197 template<bool characterPredicate(UChar)> |
198 inline VTTScanner::Run VTTScanner::collectUntil() | 198 inline VTTScanner::Run VTTScanner::collectUntil() |
199 { | 199 { |
200 if (m_is8Bit) { | 200 if (m_is8Bit) { |
201 const LChar* current = m_data.characters8; | 201 const LChar* current = m_data.characters8; |
202 ::skipUntil<LChar, LCharPredicateAdapter<characterPredicate> >(current,
m_end.characters8); | 202 ::skipUntil<LChar, LCharPredicateAdapter<characterPredicate>>(current, m
_end.characters8); |
203 return Run(position(), current, m_is8Bit); | 203 return Run(position(), current, m_is8Bit); |
204 } | 204 } |
205 const UChar* current = m_data.characters16; | 205 const UChar* current = m_data.characters16; |
206 ::skipUntil<UChar, characterPredicate>(current, m_end.characters16); | 206 ::skipUntil<UChar, characterPredicate>(current, m_end.characters16); |
207 return Run(position(), reinterpret_cast<Position>(current), m_is8Bit); | 207 return Run(position(), reinterpret_cast<Position>(current), m_is8Bit); |
208 } | 208 } |
209 | 209 |
210 inline void VTTScanner::seekTo(Position position) | 210 inline void VTTScanner::seekTo(Position position) |
211 { | 211 { |
212 ASSERT(position <= end()); | 212 ASSERT(position <= end()); |
(...skipping 11 matching lines...) Expand all Loading... |
224 ASSERT(position() < end()); | 224 ASSERT(position() < end()); |
225 if (m_is8Bit) | 225 if (m_is8Bit) |
226 m_data.characters8 += amount; | 226 m_data.characters8 += amount; |
227 else | 227 else |
228 m_data.characters16 += amount; | 228 m_data.characters16 += amount; |
229 } | 229 } |
230 | 230 |
231 } | 231 } |
232 | 232 |
233 #endif | 233 #endif |
OLD | NEW |