OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights
reserved. | 3 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights
reserved. |
4 * Copyright (C) 2009 Google Inc. All rights reserved. | 4 * Copyright (C) 2009 Google Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 template<typename CharacterTypeA, typename CharacterTypeB> | 506 template<typename CharacterTypeA, typename CharacterTypeB> |
507 inline bool equalIgnoringASCIICase(const CharacterTypeA* a, const CharacterTypeB
* b, unsigned length) | 507 inline bool equalIgnoringASCIICase(const CharacterTypeA* a, const CharacterTypeB
* b, unsigned length) |
508 { | 508 { |
509 for (unsigned i = 0; i < length; ++i) { | 509 for (unsigned i = 0; i < length; ++i) { |
510 if (toASCIILower(a[i]) != toASCIILower(b[i])) | 510 if (toASCIILower(a[i]) != toASCIILower(b[i])) |
511 return false; | 511 return false; |
512 } | 512 } |
513 return true; | 513 return true; |
514 } | 514 } |
515 | 515 |
516 template<typename CharacterTypeA, typename CharacterTypeB> | 516 WTF_EXPORT bool equalIgnoringASCIICase(const StringImpl*, const StringImpl*); |
517 inline bool equalIgnoringASCIICase(const CharacterTypeA& a, const CharacterTypeB
& b) | 517 WTF_EXPORT bool equalIgnoringASCIICase(const StringImpl*, const LChar*); |
518 { | |
519 unsigned length = b.length(); | |
520 if (a.length() != length) | |
521 return false; | |
522 if (a.is8Bit()) { | |
523 if (b.is8Bit()) | |
524 return equalIgnoringASCIICase(a.characters8(), b.characters8(), leng
th); | |
525 return equalIgnoringASCIICase(a.characters8(), b.characters16(), length)
; | |
526 } | |
527 if (b.is8Bit()) | |
528 return equalIgnoringASCIICase(a.characters16(), b.characters8(), length)
; | |
529 return equalIgnoringASCIICase(a.characters16(), b.characters16(), length); | |
530 } | |
531 | 518 |
532 template<typename CharacterType> | 519 template<typename CharacterType> |
533 inline size_t find(const CharacterType* characters, unsigned length, CharacterTy
pe matchCharacter, unsigned index = 0) | 520 inline size_t find(const CharacterType* characters, unsigned length, CharacterTy
pe matchCharacter, unsigned index = 0) |
534 { | 521 { |
535 while (index < length) { | 522 while (index < length) { |
536 if (characters[index] == matchCharacter) | 523 if (characters[index] == matchCharacter) |
537 return index; | 524 return index; |
538 ++index; | 525 ++index; |
539 } | 526 } |
540 return kNotFound; | 527 return kNotFound; |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 | 760 |
774 using WTF::StringImpl; | 761 using WTF::StringImpl; |
775 using WTF::equal; | 762 using WTF::equal; |
776 using WTF::equalNonNull; | 763 using WTF::equalNonNull; |
777 using WTF::TextCaseSensitivity; | 764 using WTF::TextCaseSensitivity; |
778 using WTF::TextCaseSensitive; | 765 using WTF::TextCaseSensitive; |
779 using WTF::TextCaseASCIIInsensitive; | 766 using WTF::TextCaseASCIIInsensitive; |
780 using WTF::TextCaseInsensitive; | 767 using WTF::TextCaseInsensitive; |
781 | 768 |
782 #endif | 769 #endif |
OLD | NEW |