| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 class String16Builder { | 75 class String16Builder { |
| 76 public: | 76 public: |
| 77 String16Builder() { } | 77 String16Builder() { } |
| 78 void append(const String16& str) { m_impl.append(StringView(str)); }; | 78 void append(const String16& str) { m_impl.append(StringView(str)); }; |
| 79 void append(UChar c) { m_impl.append(c); }; | 79 void append(UChar c) { m_impl.append(c); }; |
| 80 void append(LChar c) { m_impl.append(c); }; | 80 void append(LChar c) { m_impl.append(c); }; |
| 81 void append(char c) { m_impl.append(c); }; | 81 void append(char c) { m_impl.append(c); }; |
| 82 void append(const UChar* c, size_t size) { m_impl.append(c, size); }; | 82 void append(const UChar* c, size_t size) { m_impl.append(c, size); }; |
| 83 void append(const char* characters, unsigned length) { m_impl.append(charact
ers, length); } | 83 void append(const char* characters, unsigned length) { m_impl.append(charact
ers, length); } |
| 84 void appendNumber(int number) { m_impl.appendNumber(number); } | 84 void appendNumber(int number) { m_impl.appendNumber(number); } |
| 85 void appendNumber(double number) { m_impl.appendNumber(number); } |
| 85 String16 toString() { return m_impl.toString(); } | 86 String16 toString() { return m_impl.toString(); } |
| 86 void reserveCapacity(unsigned newCapacity) { m_impl.reserveCapacity(newCapac
ity); } | 87 void reserveCapacity(unsigned newCapacity) { m_impl.reserveCapacity(newCapac
ity); } |
| 87 | 88 |
| 88 private: | 89 private: |
| 89 WTF::StringBuilder m_impl; | 90 WTF::StringBuilder m_impl; |
| 90 }; | 91 }; |
| 91 | 92 |
| 92 inline bool operator==(const String16& a, const String16& b) { return a.impl() =
= b.impl(); } | 93 inline bool operator==(const String16& a, const String16& b) { return a.impl() =
= b.impl(); } |
| 93 inline bool operator!=(const String16& a, const String16& b) { return a.impl() !
= b.impl(); } | 94 inline bool operator!=(const String16& a, const String16& b) { return a.impl() !
= b.impl(); } |
| 94 inline bool operator==(const String16& a, const char* b) { return a.impl() == b;
} | 95 inline bool operator==(const String16& a, const char* b) { return a.impl() == b;
} |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 template<> struct hash<String16> { | 143 template<> struct hash<String16> { |
| 143 std::size_t operator()(const String16& string) const | 144 std::size_t operator()(const String16& string) const |
| 144 { | 145 { |
| 145 return StringHash::hash(string.impl()); | 146 return StringHash::hash(string.impl()); |
| 146 } | 147 } |
| 147 }; | 148 }; |
| 148 | 149 |
| 149 } // namespace std | 150 } // namespace std |
| 150 | 151 |
| 151 #endif // !defined(String16WTF_h) | 152 #endif // !defined(String16WTF_h) |
| OLD | NEW |