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 String16STL_h | 5 #ifndef String16STL_h |
6 #define String16STL_h | 6 #define String16STL_h |
7 | 7 |
8 #include <cctype> | 8 #include <cctype> |
| 9 #include <climits> |
9 #include <cstdlib> | 10 #include <cstdlib> |
10 #include <cstring> | 11 #include <cstring> |
11 #include <stdint.h> | 12 #include <stdint.h> |
12 #include <string> | 13 #include <string> |
13 #include <vector> | 14 #include <vector> |
14 | 15 |
15 using UChar = uint16_t; | 16 using UChar = uint16_t; |
16 | 17 |
17 namespace blink { | 18 namespace blink { |
18 namespace protocol { | 19 namespace protocol { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 return hash_code; | 62 return hash_code; |
62 } | 63 } |
63 | 64 |
64 private: | 65 private: |
65 std::basic_string<UChar> m_impl; | 66 std::basic_string<UChar> m_impl; |
66 mutable bool has_hash = false; | 67 mutable bool has_hash = false; |
67 mutable std::size_t hash_code = 0; | 68 mutable std::size_t hash_code = 0; |
68 }; | 69 }; |
69 | 70 |
70 inline bool operator==(const String16& a, const String16& b) { return a.impl() =
= b.impl(); } | 71 inline bool operator==(const String16& a, const String16& b) { return a.impl() =
= b.impl(); } |
| 72 inline bool operator<(const String16& a, const String16& b) { return a.impl() <
b.impl(); } |
71 inline bool operator!=(const String16& a, const String16& b) { return a.impl() !
= b.impl(); } | 73 inline bool operator!=(const String16& a, const String16& b) { return a.impl() !
= b.impl(); } |
72 inline bool operator==(const String16& a, const char* b) { return a.impl() == St
ring16(b).impl(); } | 74 inline bool operator==(const String16& a, const char* b) { return a.impl() == St
ring16(b).impl(); } |
73 inline String16 operator+(const String16& a, const char* b) { return String16(a.
impl() + String16(b).impl()); } | 75 inline String16 operator+(const String16& a, const char* b) { return String16(a.
impl() + String16(b).impl()); } |
74 inline String16 operator+(const char* a, const String16& b) { return String16(St
ring16(a).impl() + b.impl()); } | 76 inline String16 operator+(const char* a, const String16& b) { return String16(St
ring16(a).impl() + b.impl()); } |
75 inline String16 operator+(const String16& a, const String16& b) { return String1
6(a.impl() + b.impl()); } | 77 inline String16 operator+(const String16& a, const String16& b) { return String1
6(a.impl() + b.impl()); } |
76 | 78 |
77 } // namespace protocol | 79 } // namespace protocol |
78 } // namespace blink | 80 } // namespace blink |
79 | 81 |
80 #if !defined(__APPLE__) || defined(_LIBCPP_VERSION) | 82 #if !defined(__APPLE__) || defined(_LIBCPP_VERSION) |
(...skipping 12 matching lines...) Expand all Loading... |
93 | 95 |
94 class InspectorProtocolConvenienceStringType { | 96 class InspectorProtocolConvenienceStringType { |
95 public: | 97 public: |
96 // This class should not be ever instantiated, so we don't implement constru
ctors. | 98 // This class should not be ever instantiated, so we don't implement constru
ctors. |
97 InspectorProtocolConvenienceStringType(); | 99 InspectorProtocolConvenienceStringType(); |
98 InspectorProtocolConvenienceStringType(const blink::protocol::String16& othe
r); | 100 InspectorProtocolConvenienceStringType(const blink::protocol::String16& othe
r); |
99 operator blink::protocol::String16() const { return blink::protocol::String1
6(); }; | 101 operator blink::protocol::String16() const { return blink::protocol::String1
6(); }; |
100 }; | 102 }; |
101 | 103 |
102 #endif // !defined(String16STL_h) | 104 #endif // !defined(String16STL_h) |
OLD | NEW |