OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. |
4 * All rights reserved. | 4 * 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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 | 435 |
436 template <typename CharacterType> | 436 template <typename CharacterType> |
437 void appendInternal(CharacterType); | 437 void appendInternal(CharacterType); |
438 | 438 |
439 RefPtr<StringImpl> m_impl; | 439 RefPtr<StringImpl> m_impl; |
440 }; | 440 }; |
441 | 441 |
442 #undef DISPATCH_CASE_OP | 442 #undef DISPATCH_CASE_OP |
443 | 443 |
444 inline bool operator==(const String& a, const String& b) { | 444 inline bool operator==(const String& a, const String& b) { |
| 445 // We don't use equalStringView here since we want the isAtomic() fast path |
| 446 // inside WTF::equal. |
445 return equal(a.impl(), b.impl()); | 447 return equal(a.impl(), b.impl()); |
446 } | 448 } |
447 inline bool operator==(const String& a, const LChar* b) { | |
448 return equal(a.impl(), b); | |
449 } | |
450 inline bool operator==(const String& a, const char* b) { | 449 inline bool operator==(const String& a, const char* b) { |
451 return equal(a.impl(), reinterpret_cast<const LChar*>(b)); | 450 return equalStringView(a, b); |
452 } | |
453 inline bool operator==(const LChar* a, const String& b) { | |
454 return equal(a, b.impl()); | |
455 } | 451 } |
456 inline bool operator==(const char* a, const String& b) { | 452 inline bool operator==(const char* a, const String& b) { |
457 return equal(reinterpret_cast<const LChar*>(a), b.impl()); | |
458 } | |
459 template <size_t inlineCapacity> | |
460 inline bool operator==(const Vector<char, inlineCapacity>& a, const String& b) { | |
461 return equal(b.impl(), a.data(), a.size()); | |
462 } | |
463 template <size_t inlineCapacity> | |
464 inline bool operator==(const String& a, const Vector<char, inlineCapacity>& b) { | |
465 return b == a; | 453 return b == a; |
466 } | 454 } |
467 | 455 |
468 inline bool operator!=(const String& a, const String& b) { | 456 inline bool operator!=(const String& a, const String& b) { |
469 return !equal(a.impl(), b.impl()); | 457 return !(a == b); |
470 } | |
471 inline bool operator!=(const String& a, const LChar* b) { | |
472 return !equal(a.impl(), b); | |
473 } | 458 } |
474 inline bool operator!=(const String& a, const char* b) { | 459 inline bool operator!=(const String& a, const char* b) { |
475 return !equal(a.impl(), reinterpret_cast<const LChar*>(b)); | 460 return !(a == b); |
476 } | |
477 inline bool operator!=(const LChar* a, const String& b) { | |
478 return !equal(a, b.impl()); | |
479 } | 461 } |
480 inline bool operator!=(const char* a, const String& b) { | 462 inline bool operator!=(const char* a, const String& b) { |
481 return !equal(reinterpret_cast<const LChar*>(a), b.impl()); | |
482 } | |
483 template <size_t inlineCapacity> | |
484 inline bool operator!=(const Vector<char, inlineCapacity>& a, const String& b) { | |
485 return !(a == b); | 463 return !(a == b); |
486 } | 464 } |
487 template <size_t inlineCapacity> | |
488 inline bool operator!=(const String& a, const Vector<char, inlineCapacity>& b) { | |
489 return b != a; | |
490 } | |
491 | 465 |
492 inline bool equalPossiblyIgnoringCase(const String& a, | 466 inline bool equalPossiblyIgnoringCase(const String& a, |
493 const String& b, | 467 const String& b, |
494 bool ignoreCase) { | 468 bool ignoreCase) { |
495 return ignoreCase ? equalIgnoringCase(a, b) : (a == b); | 469 return ignoreCase ? equalIgnoringCase(a, b) : (a == b); |
496 } | 470 } |
497 | 471 |
498 inline bool equalIgnoringNullity(const String& a, const String& b) { | 472 inline bool equalIgnoringNullity(const String& a, const String& b) { |
499 return equalIgnoringNullity(a.impl(), b.impl()); | 473 return equalIgnoringNullity(a.impl(), b.impl()); |
500 } | 474 } |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 using WTF::String; | 596 using WTF::String; |
623 using WTF::emptyString; | 597 using WTF::emptyString; |
624 using WTF::emptyString16Bit; | 598 using WTF::emptyString16Bit; |
625 using WTF::charactersAreAllASCII; | 599 using WTF::charactersAreAllASCII; |
626 using WTF::equal; | 600 using WTF::equal; |
627 using WTF::find; | 601 using WTF::find; |
628 using WTF::isSpaceOrNewline; | 602 using WTF::isSpaceOrNewline; |
629 | 603 |
630 #include "wtf/text/AtomicString.h" | 604 #include "wtf/text/AtomicString.h" |
631 #endif // WTFString_h | 605 #endif // WTFString_h |
OLD | NEW |