OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project 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 V8_INSPECTOR_STRING16_H_ | 5 #ifndef V8_INSPECTOR_STRING16_H_ |
6 #define V8_INSPECTOR_STRING16_H_ | 6 #define V8_INSPECTOR_STRING16_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <cctype> | 9 #include <cctype> |
10 #include <climits> | 10 #include <climits> |
(...skipping 17 matching lines...) Expand all Loading... |
28 String16(const char* characters) // NOLINT(runtime/explicit) | 28 String16(const char* characters) // NOLINT(runtime/explicit) |
29 : String16(characters, std::strlen(characters)) {} | 29 : String16(characters, std::strlen(characters)) {} |
30 String16(const char* characters, size_t size) { | 30 String16(const char* characters, size_t size) { |
31 m_impl.resize(size); | 31 m_impl.resize(size); |
32 for (size_t i = 0; i < size; ++i) m_impl[i] = characters[i]; | 32 for (size_t i = 0; i < size; ++i) m_impl[i] = characters[i]; |
33 } | 33 } |
34 | 34 |
35 static String16 fromInteger(int); | 35 static String16 fromInteger(int); |
36 static String16 fromInteger(size_t); | 36 static String16 fromInteger(size_t); |
37 static String16 fromDouble(double); | 37 static String16 fromDouble(double); |
38 static String16 fromDoublePrecision3(double); | 38 static String16 fromDouble(double, int precision); |
39 static String16 fromDoublePrecision6(double); | |
40 | 39 |
41 int toInteger(bool* ok = nullptr) const; | 40 int toInteger(bool* ok = nullptr) const; |
42 String16 stripWhiteSpace() const; | 41 String16 stripWhiteSpace() const; |
43 const UChar* characters16() const { return m_impl.c_str(); } | 42 const UChar* characters16() const { return m_impl.c_str(); } |
44 size_t length() const { return m_impl.length(); } | 43 size_t length() const { return m_impl.length(); } |
45 bool isEmpty() const { return !m_impl.length(); } | 44 bool isEmpty() const { return !m_impl.length(); } |
46 UChar operator[](size_t index) const { return m_impl[index]; } | 45 UChar operator[](size_t index) const { return m_impl[index]; } |
47 String16 substring(size_t pos, size_t len = UINT_MAX) const { | 46 String16 substring(size_t pos, size_t len = UINT_MAX) const { |
48 return String16(m_impl.substr(pos, len)); | 47 return String16(m_impl.substr(pos, len)); |
49 } | 48 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 std::size_t operator()(const v8_inspector::String16& string) const { | 124 std::size_t operator()(const v8_inspector::String16& string) const { |
126 return string.hash(); | 125 return string.hash(); |
127 } | 126 } |
128 }; | 127 }; |
129 | 128 |
130 } // namespace std | 129 } // namespace std |
131 | 130 |
132 #endif // !defined(__APPLE__) || defined(_LIBCPP_VERSION) | 131 #endif // !defined(__APPLE__) || defined(_LIBCPP_VERSION) |
133 | 132 |
134 #endif // V8_INSPECTOR_STRING16_H_ | 133 #endif // V8_INSPECTOR_STRING16_H_ |
OLD | NEW |