Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: src/inspector/StringUtil.h

Issue 2338413003: [inspector] change implementation file extension from cpp to cc (Closed)
Patch Set: string16 -> string-16 Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/inspector/String16.cpp ('k') | src/inspector/StringUtil.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef V8_INSPECTOR_STRINGUTIL_H_
6 #define V8_INSPECTOR_STRINGUTIL_H_
7
8 #include "src/base/macros.h"
9 #include "src/inspector/String16.h"
10
11 #include "include/v8-inspector.h"
12
13 namespace v8_inspector {
14
15 namespace protocol {
16
17 class Value;
18
19 using String = v8_inspector::String16;
20 using StringBuilder = v8_inspector::String16Builder;
21
22 class StringUtil {
23 public:
24 static String substring(const String& s, unsigned pos, unsigned len) {
25 return s.substring(pos, len);
26 }
27 static String fromInteger(int number) { return String::fromInteger(number); }
28 static String fromDouble(double number) { return String::fromDouble(number); }
29 static const size_t kNotFound = String::kNotFound;
30 static void builderReserve(StringBuilder& builder, unsigned capacity) {
31 builder.reserveCapacity(capacity);
32 }
33 };
34
35 std::unique_ptr<protocol::Value> parseJSON(const StringView& json);
36 std::unique_ptr<protocol::Value> parseJSON(const String16& json);
37
38 } // namespace protocol
39
40 std::unique_ptr<protocol::Value> toProtocolValue(v8::Local<v8::Context>,
41 v8::Local<v8::Value>,
42 int maxDepth = 1000);
43
44 v8::Local<v8::String> toV8String(v8::Isolate*, const String16&);
45 v8::Local<v8::String> toV8StringInternalized(v8::Isolate*, const String16&);
46 v8::Local<v8::String> toV8StringInternalized(v8::Isolate*, const char*);
47 v8::Local<v8::String> toV8String(v8::Isolate*, const StringView&);
48 // TODO(dgozman): rename to toString16.
49 String16 toProtocolString(v8::Local<v8::String>);
50 String16 toProtocolStringWithTypeCheck(v8::Local<v8::Value>);
51 String16 toString16(const StringView&);
52 StringView toStringView(const String16&);
53 bool stringViewStartsWith(const StringView&, const char*);
54
55 class StringBufferImpl : public StringBuffer {
56 DISALLOW_COPY_AND_ASSIGN(StringBufferImpl);
57
58 public:
59 // Destroys string's content.
60 static std::unique_ptr<StringBufferImpl> adopt(String16&);
61 const StringView& string() override { return m_string; }
62
63 private:
64 explicit StringBufferImpl(String16&);
65 String16 m_owner;
66 StringView m_string;
67 };
68
69 } // namespace v8_inspector
70
71 #endif // V8_INSPECTOR_STRINGUTIL_H_
OLDNEW
« no previous file with comments | « src/inspector/String16.cpp ('k') | src/inspector/StringUtil.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698