Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: third_party/WebKit/Source/wtf/text/StringImpl.h

Issue 2148423003: Use StringView for equalIgnoringCase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DCHECK is silly. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 { 470 {
471 for (unsigned i = 0; i < length; ++i) { 471 for (unsigned i = 0; i < length; ++i) {
472 if (a[i] != b[i]) 472 if (a[i] != b[i])
473 return false; 473 return false;
474 } 474 }
475 return true; 475 return true;
476 } 476 }
477 477
478 ALWAYS_INLINE bool equal(const UChar* a, const LChar* b, unsigned length) { retu rn equal(b, a, length); } 478 ALWAYS_INLINE bool equal(const UChar* a, const LChar* b, unsigned length) { retu rn equal(b, a, length); }
479 479
480 WTF_EXPORT bool equalIgnoringCase(const StringImpl*, const StringImpl*);
481 WTF_EXPORT bool equalIgnoringCase(const StringImpl*, const LChar*);
482 inline bool equalIgnoringCase(const LChar* a, const StringImpl* b) { return equa lIgnoringCase(b, a); }
483 WTF_EXPORT bool equalIgnoringCase(const LChar*, const LChar*, unsigned length); 480 WTF_EXPORT bool equalIgnoringCase(const LChar*, const LChar*, unsigned length);
484 WTF_EXPORT bool equalIgnoringCase(const UChar*, const LChar*, unsigned length); 481 WTF_EXPORT bool equalIgnoringCase(const UChar*, const LChar*, unsigned length);
485 inline bool equalIgnoringCase(const UChar* a, const char* b, unsigned length) { return equalIgnoringCase(a, reinterpret_cast<const LChar*>(b), length); } 482 inline bool equalIgnoringCase(const LChar* a, const UChar* b, unsigned length)
486 inline bool equalIgnoringCase(const LChar* a, const UChar* b, unsigned length) { return equalIgnoringCase(b, a, length); }
487 inline bool equalIgnoringCase(const char* a, const UChar* b, unsigned length) { return equalIgnoringCase(b, reinterpret_cast<const LChar*>(a), length); }
488 inline bool equalIgnoringCase(const char* a, const LChar* b, unsigned length) { return equalIgnoringCase(b, reinterpret_cast<const LChar*>(a), length); }
489 inline bool equalIgnoringCase(const UChar* a, const UChar* b, int length)
490 { 483 {
491 ASSERT(length >= 0); 484 return equalIgnoringCase(b, a, length);
492 return !Unicode::umemcasecmp(a, b, length);
493 } 485 }
494 WTF_EXPORT bool equalIgnoringCaseNonNull(const StringImpl*, const StringImpl*); 486
487 WTF_EXPORT bool equalIgnoringCase(const UChar*, const UChar*, unsigned length);
495 488
496 WTF_EXPORT bool equalIgnoringNullity(StringImpl*, StringImpl*); 489 WTF_EXPORT bool equalIgnoringNullity(StringImpl*, StringImpl*);
497 490
498 template<typename CharacterTypeA, typename CharacterTypeB> 491 template<typename CharacterTypeA, typename CharacterTypeB>
499 inline bool equalIgnoringASCIICase(const CharacterTypeA* a, const CharacterTypeB * b, unsigned length) 492 inline bool equalIgnoringASCIICase(const CharacterTypeA* a, const CharacterTypeB * b, unsigned length)
500 { 493 {
501 for (unsigned i = 0; i < length; ++i) { 494 for (unsigned i = 0; i < length; ++i) {
502 if (toASCIILower(a[i]) != toASCIILower(b[i])) 495 if (toASCIILower(a[i]) != toASCIILower(b[i]))
503 return false; 496 return false;
504 } 497 }
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 using WTF::StringImpl; 713 using WTF::StringImpl;
721 using WTF::TextCaseASCIIInsensitive; 714 using WTF::TextCaseASCIIInsensitive;
722 using WTF::TextCaseInsensitive; 715 using WTF::TextCaseInsensitive;
723 using WTF::TextCaseSensitive; 716 using WTF::TextCaseSensitive;
724 using WTF::TextCaseSensitivity; 717 using WTF::TextCaseSensitivity;
725 using WTF::equal; 718 using WTF::equal;
726 using WTF::equalNonNull; 719 using WTF::equalNonNull;
727 using WTF::lengthOfNullTerminatedString; 720 using WTF::lengthOfNullTerminatedString;
728 721
729 #endif 722 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringHash.h ('k') | third_party/WebKit/Source/wtf/text/StringImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698