| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 ~String16() { } | 43 ~String16() { } |
| 44 | 44 |
| 45 static String16 fromInteger(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 size_t charactersSizeInBytes() const { return m_impl.charactersSizeInBytes()
; } |
| 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 |
| 56 static double charactersToDouble(const LChar* characters, size_t length, boo
l* ok = 0) { return ::charactersToDouble(characters, length, ok); } | 56 static double charactersToDouble(const LChar* characters, size_t length, boo
l* ok = 0) { return ::charactersToDouble(characters, length, ok); } |
| 57 static double charactersToDouble(const UChar* characters, size_t length, boo
l* ok = 0) { return ::charactersToDouble(characters, length, ok); } | 57 static double charactersToDouble(const UChar* characters, size_t length, boo
l* ok = 0) { return ::charactersToDouble(characters, length, ok); } |
| 58 | 58 |
| 59 String16 substring(unsigned pos, unsigned len = UINT_MAX) const { return m_i
mpl.substring(pos, len); } | 59 String16 substring(unsigned pos, unsigned len = UINT_MAX) const { return m_i
mpl.substring(pos, len); } |
| 60 String16 stripWhiteSpace() const { return m_impl.stripWhiteSpace(); } | 60 String16 stripWhiteSpace() const { return m_impl.stripWhiteSpace(); } |
| 61 | 61 |
| 62 int toInt(bool* ok = 0) const { return m_impl.toInt(ok); } | 62 int toInt(bool* ok = 0) const { return m_impl.toInt(ok); } |
| 63 | 63 |
| (...skipping 81 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 |