| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 133 |
| 133 template<> | 134 template<> |
| 134 struct HashTraits<String16> : SimpleClassHashTraits<String16> { | 135 struct HashTraits<String16> : SimpleClassHashTraits<String16> { |
| 135 static const bool hasIsEmptyValueFunction = true; | 136 static const bool hasIsEmptyValueFunction = true; |
| 136 static bool isEmptyValue(const String16& a) { return a.impl().isNull(); } | 137 static bool isEmptyValue(const String16& a) { return a.impl().isNull(); } |
| 137 }; | 138 }; |
| 138 | 139 |
| 139 } // namespace WTF | 140 } // namespace WTF |
| 140 | 141 |
| 141 #endif // !defined(String16WTF_h) | 142 #endif // !defined(String16WTF_h) |
| OLD | NEW |