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 22 matching lines...) Expand all Loading... |
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 | 38 |
39 ~String16() { } | 39 ~String16() { } |
40 | 40 |
41 static String16 number(int i) { return String::number(i); } | 41 static String16 number(int i) { return String::number(i); } |
42 static String16 fromDouble(double number) { return Decimal::fromDouble(numbe
r).toString(); } | 42 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); } |
43 | 44 |
44 size_t length() const { return m_impl.length(); } | 45 size_t length() const { return m_impl.length(); } |
45 bool isEmpty() const { return m_impl.isEmpty(); } | 46 bool isEmpty() const { return m_impl.isEmpty(); } |
46 UChar operator[](unsigned index) const { return m_impl[index]; } | 47 UChar operator[](unsigned index) const { return m_impl[index]; } |
47 | 48 |
48 unsigned sizeInBytes() const { return m_impl.sizeInBytes(); } | 49 unsigned sizeInBytes() const { return m_impl.sizeInBytes(); } |
49 const UChar* characters16() const { return m_impl.isEmpty() ? nullptr : m_im
pl.characters16(); } | 50 const UChar* characters16() const { return m_impl.isEmpty() ? nullptr : m_im
pl.characters16(); } |
50 | 51 |
51 static double charactersToDouble(const LChar* characters, size_t length, boo
l* ok = 0) { return ::charactersToDouble(characters, length, ok); } | 52 static double charactersToDouble(const LChar* characters, size_t length, boo
l* ok = 0) { return ::charactersToDouble(characters, length, ok); } |
52 static double charactersToDouble(const UChar* characters, size_t length, boo
l* ok = 0) { return ::charactersToDouble(characters, length, ok); } | 53 static double charactersToDouble(const UChar* characters, size_t length, boo
l* ok = 0) { return ::charactersToDouble(characters, length, ok); } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 130 |
130 template<> | 131 template<> |
131 struct HashTraits<String16> : SimpleClassHashTraits<String16> { | 132 struct HashTraits<String16> : SimpleClassHashTraits<String16> { |
132 static const bool hasIsEmptyValueFunction = true; | 133 static const bool hasIsEmptyValueFunction = true; |
133 static bool isEmptyValue(const String16& a) { return a.impl().isNull(); } | 134 static bool isEmptyValue(const String16& a) { return a.impl().isNull(); } |
134 }; | 135 }; |
135 | 136 |
136 } // namespace WTF | 137 } // namespace WTF |
137 | 138 |
138 #endif // !defined(String16WTF_h) | 139 #endif // !defined(String16WTF_h) |
OLD | NEW |