| 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 <memory> |
| 9 |
| 10 #include "src/base/logging.h" |
| 8 #include "src/base/macros.h" | 11 #include "src/base/macros.h" |
| 9 #include "src/inspector/string-16.h" | 12 #include "src/inspector/string-16.h" |
| 10 | 13 |
| 11 #include "include/v8-inspector.h" | 14 #include "include/v8-inspector.h" |
| 12 | 15 |
| 13 namespace v8_inspector { | 16 namespace v8_inspector { |
| 14 | 17 |
| 15 namespace protocol { | 18 namespace protocol { |
| 16 | 19 |
| 17 class Value; | 20 class Value; |
| 18 | 21 |
| 19 using String = v8_inspector::String16; | 22 using String = v8_inspector::String16; |
| 20 using StringBuilder = v8_inspector::String16Builder; | 23 using StringBuilder = v8_inspector::String16Builder; |
| 21 | 24 |
| 22 class StringUtil { | 25 class StringUtil { |
| 23 public: | 26 public: |
| 24 static String substring(const String& s, size_t pos, size_t len) { | 27 static String substring(const String& s, size_t pos, size_t len) { |
| 25 return s.substring(pos, len); | 28 return s.substring(pos, len); |
| 26 } | 29 } |
| 27 static String fromInteger(int number) { return String::fromInteger(number); } | 30 static String fromInteger(int number) { return String::fromInteger(number); } |
| 28 static String fromInteger(size_t number) { | 31 static String fromInteger(size_t number) { |
| 29 return String::fromInteger(number); | 32 return String::fromInteger(number); |
| 30 } | 33 } |
| 31 static String fromDouble(double number) { return String::fromDouble(number); } | 34 static String fromDouble(double number) { return String::fromDouble(number); } |
| 32 static const size_t kNotFound = String::kNotFound; | 35 static const size_t kNotFound = String::kNotFound; |
| 33 static void builderReserve(StringBuilder& builder, size_t capacity) { | 36 static void builderReserve(StringBuilder& builder, size_t capacity) { |
| 34 builder.reserveCapacity(capacity); | 37 builder.reserveCapacity(capacity); |
| 35 } | 38 } |
| 39 static std::unique_ptr<protocol::Value> parseJSON(const String16& json); |
| 40 static std::unique_ptr<protocol::Value> parseJSON(const StringView& json); |
| 36 }; | 41 }; |
| 37 | 42 |
| 38 std::unique_ptr<protocol::Value> parseJSON(const StringView& json); | |
| 39 std::unique_ptr<protocol::Value> parseJSON(const String16& json); | |
| 40 | |
| 41 } // namespace protocol | 43 } // namespace protocol |
| 42 | 44 |
| 43 v8::Local<v8::String> toV8String(v8::Isolate*, const String16&); | 45 v8::Local<v8::String> toV8String(v8::Isolate*, const String16&); |
| 44 v8::Local<v8::String> toV8StringInternalized(v8::Isolate*, const String16&); | 46 v8::Local<v8::String> toV8StringInternalized(v8::Isolate*, const String16&); |
| 45 v8::Local<v8::String> toV8StringInternalized(v8::Isolate*, const char*); | 47 v8::Local<v8::String> toV8StringInternalized(v8::Isolate*, const char*); |
| 46 v8::Local<v8::String> toV8String(v8::Isolate*, const StringView&); | 48 v8::Local<v8::String> toV8String(v8::Isolate*, const StringView&); |
| 47 // TODO(dgozman): rename to toString16. | 49 // TODO(dgozman): rename to toString16. |
| 48 String16 toProtocolString(v8::Local<v8::String>); | 50 String16 toProtocolString(v8::Local<v8::String>); |
| 49 String16 toProtocolStringWithTypeCheck(v8::Local<v8::Value>); | 51 String16 toProtocolStringWithTypeCheck(v8::Local<v8::Value>); |
| 50 String16 toString16(const StringView&); | 52 String16 toString16(const StringView&); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 61 explicit StringBufferImpl(String16&); | 63 explicit StringBufferImpl(String16&); |
| 62 String16 m_owner; | 64 String16 m_owner; |
| 63 StringView m_string; | 65 StringView m_string; |
| 64 | 66 |
| 65 DISALLOW_COPY_AND_ASSIGN(StringBufferImpl); | 67 DISALLOW_COPY_AND_ASSIGN(StringBufferImpl); |
| 66 }; | 68 }; |
| 67 | 69 |
| 68 } // namespace v8_inspector | 70 } // namespace v8_inspector |
| 69 | 71 |
| 70 #endif // V8_INSPECTOR_STRINGUTIL_H_ | 72 #endif // V8_INSPECTOR_STRINGUTIL_H_ |
| OLD | NEW |