| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef String16WTF_h | 5 #ifndef String16WTF_h |
| 6 #define String16WTF_h | 6 #define String16WTF_h |
| 7 | 7 |
| 8 #include "platform/Decimal.h" | 8 #include "platform/Decimal.h" |
| 9 #include "public/platform/WebString.h" | 9 #include "public/platform/WebString.h" |
| 10 #include "wtf/text/StringBuilder.h" | 10 #include "wtf/text/StringBuilder.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 String16(WTF::HashTableDeletedValueType) : m_impl(WTF::HashTableDeletedValue
) { } | 35 String16(WTF::HashTableDeletedValueType) : m_impl(WTF::HashTableDeletedValue
) { } |
| 36 bool isHashTableDeletedValue() const { return m_impl.isHashTableDeletedValue
(); } | 36 bool isHashTableDeletedValue() const { return m_impl.isHashTableDeletedValue
(); } |
| 37 operator WTF::String() const { return m_impl; } | 37 operator WTF::String() const { return m_impl; } |
| 38 operator WTF::StringView() const { return StringView(m_impl); } | 38 operator WTF::StringView() const { return StringView(m_impl); } |
| 39 operator WebString() { return m_impl; } | 39 operator WebString() { return m_impl; } |
| 40 const WTF::String& impl() const { return m_impl; } | 40 const WTF::String& impl() const { return m_impl; } |
| 41 String16 isolatedCopy() const { return String16(m_impl.isolatedCopy()); } | 41 String16 isolatedCopy() const { return String16(m_impl.isolatedCopy()); } |
| 42 | 42 |
| 43 ~String16() { } | 43 ~String16() { } |
| 44 | 44 |
| 45 static String16 number(int i) { return String::number(i); } | 45 static String16 fromInteger(int i) { return String::number(i); } |
| 46 static String16 fromDouble(double number) { return Decimal::fromDouble(numbe
r).toString(); } | 46 static String16 fromDouble(double number) { return Decimal::fromDouble(numbe
r).toString(); } |
| 47 static String16 fromDoubleFixedPrecision(double number, int precision) { ret
urn String::numberToStringFixedWidth(number, precision); } | 47 static String16 fromDoubleFixedPrecision(double number, int precision) { ret
urn String::numberToStringFixedWidth(number, precision); } |
| 48 | 48 |
| 49 size_t length() const { return m_impl.length(); } | 49 size_t length() const { return m_impl.length(); } |
| 50 bool isEmpty() const { return m_impl.isEmpty(); } | 50 bool isEmpty() const { return m_impl.isEmpty(); } |
| 51 UChar operator[](unsigned index) const { return m_impl[index]; } | 51 UChar operator[](unsigned index) const { return m_impl[index]; } |
| 52 | 52 |
| 53 unsigned sizeInBytes() const { return m_impl.sizeInBytes(); } | 53 unsigned sizeInBytes() const { return m_impl.sizeInBytes(); } |
| 54 const UChar* characters16() const { return m_impl.isEmpty() ? nullptr : m_im
pl.characters16(); } | 54 const UChar* characters16() const { return m_impl.isEmpty() ? nullptr : m_im
pl.characters16(); } |
| 55 | 55 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 template<> struct hash<String16> { | 145 template<> struct hash<String16> { |
| 146 std::size_t operator()(const String16& string) const | 146 std::size_t operator()(const String16& string) const |
| 147 { | 147 { |
| 148 return StringHash::hash(string.impl()); | 148 return StringHash::hash(string.impl()); |
| 149 } | 149 } |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 } // namespace std | 152 } // namespace std |
| 153 | 153 |
| 154 #endif // !defined(String16WTF_h) | 154 #endif // !defined(String16WTF_h) |
| OLD | NEW |