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 17 matching lines...) Expand all Loading... |
28 String16(const WebString& other) : String16(String(other)) { } | 28 String16(const WebString& other) : String16(String(other)) { } |
29 template<typename StringType1, typename StringType2> | 29 template<typename StringType1, typename StringType2> |
30 String16(const WTF::StringAppend<StringType1, StringType2>& impl) : String16
(String(impl)) { } | 30 String16(const WTF::StringAppend<StringType1, StringType2>& impl) : String16
(String(impl)) { } |
31 String16(const WTF::AtomicString& impl) : String16(String(impl)) { } | 31 String16(const WTF::AtomicString& impl) : String16(String(impl)) { } |
32 String16(const WTF::String& impl); | 32 String16(const WTF::String& impl); |
33 String16(WTF::HashTableDeletedValueType) : m_impl(WTF::HashTableDeletedValue
) { } | 33 String16(WTF::HashTableDeletedValueType) : m_impl(WTF::HashTableDeletedValue
) { } |
34 bool isHashTableDeletedValue() const { return m_impl.isHashTableDeletedValue
(); } | 34 bool isHashTableDeletedValue() const { return m_impl.isHashTableDeletedValue
(); } |
35 operator WTF::String() const { return m_impl; } | 35 operator WTF::String() const { return m_impl; } |
36 operator WebString() { return m_impl; } | 36 operator WebString() { return m_impl; } |
37 const WTF::String& impl() const { return m_impl; } | 37 const WTF::String& impl() const { return m_impl; } |
| 38 String16 isolatedCopy() const { return String16(m_impl.isolatedCopy()); } |
38 | 39 |
39 ~String16() { } | 40 ~String16() { } |
40 | 41 |
41 static String16 number(int i) { return String::number(i); } | 42 static String16 number(int i) { return String::number(i); } |
42 static String16 fromDouble(double number) { return Decimal::fromDouble(numbe
r).toString(); } | 43 static String16 fromDouble(double number) { return Decimal::fromDouble(numbe
r).toString(); } |
43 static String16 fromDoubleFixedPrecision(double number, int precision) { ret
urn String::numberToStringFixedWidth(number, precision); } | 44 static String16 fromDoubleFixedPrecision(double number, int precision) { ret
urn String::numberToStringFixedWidth(number, precision); } |
44 | 45 |
45 size_t length() const { return m_impl.length(); } | 46 size_t length() const { return m_impl.length(); } |
46 bool isEmpty() const { return m_impl.isEmpty(); } | 47 bool isEmpty() const { return m_impl.isEmpty(); } |
47 UChar operator[](unsigned index) const { return m_impl[index]; } | 48 UChar operator[](unsigned index) const { return m_impl[index]; } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 131 |
131 template<> | 132 template<> |
132 struct HashTraits<String16> : SimpleClassHashTraits<String16> { | 133 struct HashTraits<String16> : SimpleClassHashTraits<String16> { |
133 static const bool hasIsEmptyValueFunction = true; | 134 static const bool hasIsEmptyValueFunction = true; |
134 static bool isEmptyValue(const String16& a) { return a.impl().isNull(); } | 135 static bool isEmptyValue(const String16& a) { return a.impl().isNull(); } |
135 }; | 136 }; |
136 | 137 |
137 } // namespace WTF | 138 } // namespace WTF |
138 | 139 |
139 #endif // !defined(String16WTF_h) | 140 #endif // !defined(String16WTF_h) |
OLD | NEW |