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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 unsigned length() const { | 118 unsigned length() const { |
119 if (!m_impl) | 119 if (!m_impl) |
120 return 0; | 120 return 0; |
121 return m_impl->length(); | 121 return m_impl->length(); |
122 } | 122 } |
123 | 123 |
124 const LChar* characters8() const { | 124 const LChar* characters8() const { |
125 if (!m_impl) | 125 if (!m_impl) |
126 return 0; | 126 return 0; |
127 ASSERT(m_impl->is8Bit()); | 127 DCHECK(m_impl->is8Bit()); |
128 return m_impl->characters8(); | 128 return m_impl->characters8(); |
129 } | 129 } |
130 | 130 |
131 const UChar* characters16() const { | 131 const UChar* characters16() const { |
132 if (!m_impl) | 132 if (!m_impl) |
133 return 0; | 133 return 0; |
134 ASSERT(!m_impl->is8Bit()); | 134 DCHECK(!m_impl->is8Bit()); |
135 return m_impl->characters16(); | 135 return m_impl->characters16(); |
136 } | 136 } |
137 | 137 |
138 // Return characters8() or characters16() depending on CharacterType. | 138 // Return characters8() or characters16() depending on CharacterType. |
139 template <typename CharacterType> | 139 template <typename CharacterType> |
140 inline const CharacterType* getCharacters() const; | 140 inline const CharacterType* getCharacters() const; |
141 | 141 |
142 bool is8Bit() const { return m_impl->is8Bit(); } | 142 bool is8Bit() const { return m_impl->is8Bit(); } |
143 | 143 |
144 CString ascii() const; | 144 CString ascii() const; |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 | 516 |
517 // Definitions of string operations | 517 // Definitions of string operations |
518 | 518 |
519 template <size_t inlineCapacity> | 519 template <size_t inlineCapacity> |
520 String::String(const Vector<UChar, inlineCapacity>& vector) | 520 String::String(const Vector<UChar, inlineCapacity>& vector) |
521 : m_impl(vector.size() ? StringImpl::create(vector.data(), vector.size()) | 521 : m_impl(vector.size() ? StringImpl::create(vector.data(), vector.size()) |
522 : StringImpl::empty()) {} | 522 : StringImpl::empty()) {} |
523 | 523 |
524 template <> | 524 template <> |
525 inline const LChar* String::getCharacters<LChar>() const { | 525 inline const LChar* String::getCharacters<LChar>() const { |
526 ASSERT(is8Bit()); | 526 DCHECK(is8Bit()); |
527 return characters8(); | 527 return characters8(); |
528 } | 528 } |
529 | 529 |
530 template <> | 530 template <> |
531 inline const UChar* String::getCharacters<UChar>() const { | 531 inline const UChar* String::getCharacters<UChar>() const { |
532 ASSERT(!is8Bit()); | 532 DCHECK(!is8Bit()); |
533 return characters16(); | 533 return characters16(); |
534 } | 534 } |
535 | 535 |
536 inline bool String::containsOnlyLatin1() const { | 536 inline bool String::containsOnlyLatin1() const { |
537 if (isEmpty()) | 537 if (isEmpty()) |
538 return true; | 538 return true; |
539 | 539 |
540 if (is8Bit()) | 540 if (is8Bit()) |
541 return true; | 541 return true; |
542 | 542 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 using WTF::emptyString; | 653 using WTF::emptyString; |
654 using WTF::emptyString16Bit; | 654 using WTF::emptyString16Bit; |
655 using WTF::charactersAreAllASCII; | 655 using WTF::charactersAreAllASCII; |
656 using WTF::equal; | 656 using WTF::equal; |
657 using WTF::find; | 657 using WTF::find; |
658 using WTF::isAllSpecialCharacters; | 658 using WTF::isAllSpecialCharacters; |
659 using WTF::isSpaceOrNewline; | 659 using WTF::isSpaceOrNewline; |
660 | 660 |
661 #include "wtf/text/AtomicString.h" | 661 #include "wtf/text/AtomicString.h" |
662 #endif // WTFString_h | 662 #endif // WTFString_h |
OLD | NEW |