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_STRINGUTIL_H_ | 5 #ifndef V8_INSPECTOR_STRINGUTIL_H_ |
6 #define V8_INSPECTOR_STRINGUTIL_H_ | 6 #define V8_INSPECTOR_STRINGUTIL_H_ |
7 | 7 |
8 #include "src/inspector/Allocator.h" | 8 #include "src/inspector/Allocator.h" |
9 #include "src/inspector/String16.h" | 9 #include "src/inspector/String16.h" |
10 | 10 |
11 #include "include/v8-inspector.h" | 11 #include "include/v8-inspector.h" |
12 | 12 |
13 namespace v8_inspector { | 13 namespace v8_inspector { |
14 | 14 |
15 namespace protocol { | 15 namespace protocol { |
16 | 16 |
17 class Value; | 17 class Value; |
18 | 18 |
19 using String = v8_inspector::String16; | 19 using String = v8_inspector::String16; |
20 using StringBuilder = v8_inspector::String16Builder; | 20 using StringBuilder = v8_inspector::String16Builder; |
21 | 21 |
22 class StringUtil { | 22 class StringUtil { |
23 public: | 23 public: |
24 static String substring(const String& s, size_t pos, size_t len) { | 24 static String substring(const String& s, unsigned pos, unsigned len) { |
25 return s.substring(pos, len); | 25 return s.substring(pos, len); |
26 } | 26 } |
27 static String fromInteger(int number) { return String::fromInteger(number); } | 27 static String fromInteger(int number) { return String::fromInteger(number); } |
28 static String fromInteger(size_t number) { | |
29 return String::fromInteger(number); | |
30 } | |
31 static String fromDouble(double number) { return String::fromDouble(number); } | 28 static String fromDouble(double number) { return String::fromDouble(number); } |
32 static const size_t kNotFound = String::kNotFound; | 29 static const size_t kNotFound = String::kNotFound; |
33 static void builderReserve(StringBuilder& builder, size_t capacity) { | 30 static void builderReserve(StringBuilder& builder, unsigned capacity) { |
34 builder.reserveCapacity(capacity); | 31 builder.reserveCapacity(capacity); |
35 } | 32 } |
36 }; | 33 }; |
37 | 34 |
38 std::unique_ptr<protocol::Value> parseJSON(const StringView& json); | 35 std::unique_ptr<protocol::Value> parseJSON(const StringView& json); |
39 std::unique_ptr<protocol::Value> parseJSON(const String16& json); | 36 std::unique_ptr<protocol::Value> parseJSON(const String16& json); |
40 | 37 |
41 } // namespace protocol | 38 } // namespace protocol |
42 | 39 |
43 std::unique_ptr<protocol::Value> toProtocolValue(v8::Local<v8::Context>, | 40 std::unique_ptr<protocol::Value> toProtocolValue(v8::Local<v8::Context>, |
(...skipping 21 matching lines...) Expand all Loading... |
65 | 62 |
66 private: | 63 private: |
67 explicit StringBufferImpl(String16&); | 64 explicit StringBufferImpl(String16&); |
68 String16 m_owner; | 65 String16 m_owner; |
69 StringView m_string; | 66 StringView m_string; |
70 }; | 67 }; |
71 | 68 |
72 } // namespace v8_inspector | 69 } // namespace v8_inspector |
73 | 70 |
74 #endif // V8_INSPECTOR_STRINGUTIL_H_ | 71 #endif // V8_INSPECTOR_STRINGUTIL_H_ |
OLD | NEW |