| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 // Construct a string referencing an existing StringImpl. | 98 // Construct a string referencing an existing StringImpl. |
| 99 String(StringImpl* impl) : m_impl(impl) {} | 99 String(StringImpl* impl) : m_impl(impl) {} |
| 100 String(PassRefPtr<StringImpl> impl) : m_impl(impl) {} | 100 String(PassRefPtr<StringImpl> impl) : m_impl(impl) {} |
| 101 | 101 |
| 102 void swap(String& o) { m_impl.swap(o.m_impl); } | 102 void swap(String& o) { m_impl.swap(o.m_impl); } |
| 103 | 103 |
| 104 template <typename CharType> | 104 template <typename CharType> |
| 105 static String adopt(StringBuffer<CharType>& buffer) { | 105 static String adopt(StringBuffer<CharType>& buffer) { |
| 106 if (!buffer.length()) | 106 if (!buffer.length()) |
| 107 return StringImpl::empty(); | 107 return StringImpl::empty; |
| 108 return String(buffer.release()); | 108 return String(buffer.release()); |
| 109 } | 109 } |
| 110 | 110 |
| 111 explicit operator bool() const { return !isNull(); } | 111 explicit operator bool() const { return !isNull(); } |
| 112 bool isNull() const { return !m_impl; } | 112 bool isNull() const { return !m_impl; } |
| 113 bool isEmpty() const { return !m_impl || !m_impl->length(); } | 113 bool isEmpty() const { return !m_impl || !m_impl->length(); } |
| 114 | 114 |
| 115 StringImpl* impl() const { return m_impl.get(); } | 115 StringImpl* impl() const { return m_impl.get(); } |
| 116 PassRefPtr<StringImpl> releaseImpl() { return m_impl.release(); } | 116 PassRefPtr<StringImpl> releaseImpl() { return m_impl.release(); } |
| 117 | 117 |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 | 482 |
| 483 inline void swap(String& a, String& b) { | 483 inline void swap(String& a, String& b) { |
| 484 a.swap(b); | 484 a.swap(b); |
| 485 } | 485 } |
| 486 | 486 |
| 487 // Definitions of string operations | 487 // Definitions of string operations |
| 488 | 488 |
| 489 template <size_t inlineCapacity> | 489 template <size_t inlineCapacity> |
| 490 String::String(const Vector<UChar, inlineCapacity>& vector) | 490 String::String(const Vector<UChar, inlineCapacity>& vector) |
| 491 : m_impl(vector.size() ? StringImpl::create(vector.data(), vector.size()) | 491 : m_impl(vector.size() ? StringImpl::create(vector.data(), vector.size()) |
| 492 : StringImpl::empty()) {} | 492 : StringImpl::empty) {} |
| 493 | 493 |
| 494 template <> | 494 template <> |
| 495 inline const LChar* String::getCharacters<LChar>() const { | 495 inline const LChar* String::getCharacters<LChar>() const { |
| 496 DCHECK(is8Bit()); | 496 DCHECK(is8Bit()); |
| 497 return characters8(); | 497 return characters8(); |
| 498 } | 498 } |
| 499 | 499 |
| 500 template <> | 500 template <> |
| 501 inline const UChar* String::getCharacters<UChar>() const { | 501 inline const UChar* String::getCharacters<UChar>() const { |
| 502 DCHECK(!is8Bit()); | 502 DCHECK(!is8Bit()); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 using WTF::String; | 593 using WTF::String; |
| 594 using WTF::emptyString; | 594 using WTF::emptyString; |
| 595 using WTF::emptyString16Bit; | 595 using WTF::emptyString16Bit; |
| 596 using WTF::charactersAreAllASCII; | 596 using WTF::charactersAreAllASCII; |
| 597 using WTF::equal; | 597 using WTF::equal; |
| 598 using WTF::find; | 598 using WTF::find; |
| 599 using WTF::isSpaceOrNewline; | 599 using WTF::isSpaceOrNewline; |
| 600 | 600 |
| 601 #include "wtf/text/AtomicString.h" | 601 #include "wtf/text/AtomicString.h" |
| 602 #endif // WTFString_h | 602 #endif // WTFString_h |
| OLD | NEW |