OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WTF_StringView_h | 5 #ifndef WTF_StringView_h |
6 #define WTF_StringView_h | 6 #define WTF_StringView_h |
7 | 7 |
8 #include "platform/wtf/Allocator.h" | 8 #include "platform/wtf/Allocator.h" |
9 #include "platform/wtf/GetPtr.h" | 9 #include "platform/wtf/GetPtr.h" |
10 #if DCHECK_IS_ON() | 10 #if DCHECK_IS_ON() |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 impl_ = const_cast<StringImpl*>(&impl); | 214 impl_ = const_cast<StringImpl*>(&impl); |
215 if (impl.Is8Bit()) | 215 if (impl.Is8Bit()) |
216 characters8_ = impl.Characters8() + offset; | 216 characters8_ = impl.Characters8() + offset; |
217 else | 217 else |
218 characters16_ = impl.Characters16() + offset; | 218 characters16_ = impl.Characters16() + offset; |
219 } | 219 } |
220 | 220 |
221 // Unicode aware case insensitive string matching. Non-ASCII characters might | 221 // Unicode aware case insensitive string matching. Non-ASCII characters might |
222 // match to ASCII characters. These functions are rarely used to implement web | 222 // match to ASCII characters. These functions are rarely used to implement web |
223 // platform features. | 223 // platform features. |
224 WTF_EXPORT bool EqualIgnoringCase(const StringView&, const StringView&); | 224 // These functions are deprecated. Use EqualIgnoringASCIICase(), or introduce |
225 WTF_EXPORT bool EqualIgnoringCaseAndNullity(const StringView&, | 225 // EqualIgnoringUnicodeCase(). See crbug.com/627682 |
| 226 WTF_EXPORT bool DeprecatedEqualIgnoringCase(const StringView&, |
226 const StringView&); | 227 const StringView&); |
| 228 WTF_EXPORT bool DeprecatedEqualIgnoringCaseAndNullity(const StringView&, |
| 229 const StringView&); |
227 | 230 |
228 WTF_EXPORT bool EqualIgnoringASCIICase(const StringView&, const StringView&); | 231 WTF_EXPORT bool EqualIgnoringASCIICase(const StringView&, const StringView&); |
229 | 232 |
230 // TODO(esprehn): Can't make this an overload of WTF::equal since that makes | 233 // TODO(esprehn): Can't make this an overload of WTF::equal since that makes |
231 // calls to equal() that pass literal strings ambiguous. Figure out if we can | 234 // calls to equal() that pass literal strings ambiguous. Figure out if we can |
232 // replace all the callers with equalStringView and then rename it to equal(). | 235 // replace all the callers with equalStringView and then rename it to equal(). |
233 WTF_EXPORT bool EqualStringView(const StringView&, const StringView&); | 236 WTF_EXPORT bool EqualStringView(const StringView&, const StringView&); |
234 | 237 |
235 inline bool operator==(const StringView& a, const StringView& b) { | 238 inline bool operator==(const StringView& a, const StringView& b) { |
236 return EqualStringView(a, b); | 239 return EqualStringView(a, b); |
(...skipping 22 matching lines...) Expand all Loading... |
259 return Is8Bit() ? WTF::IsAllSpecialCharacters<isSpecialCharacter, LChar>( | 262 return Is8Bit() ? WTF::IsAllSpecialCharacters<isSpecialCharacter, LChar>( |
260 Characters8(), len) | 263 Characters8(), len) |
261 : WTF::IsAllSpecialCharacters<isSpecialCharacter, UChar>( | 264 : WTF::IsAllSpecialCharacters<isSpecialCharacter, UChar>( |
262 Characters16(), len); | 265 Characters16(), len); |
263 } | 266 } |
264 | 267 |
265 } // namespace WTF | 268 } // namespace WTF |
266 | 269 |
267 using WTF::StringView; | 270 using WTF::StringView; |
268 using WTF::EqualIgnoringASCIICase; | 271 using WTF::EqualIgnoringASCIICase; |
269 using WTF::EqualIgnoringCase; | 272 using WTF::DeprecatedEqualIgnoringCase; |
270 using WTF::IsAllSpecialCharacters; | 273 using WTF::IsAllSpecialCharacters; |
271 | 274 |
272 #endif | 275 #endif |
OLD | NEW |