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

Side by Side Diff: content/browser/devtools/protocol_string.h

Issue 2493063005: [DevTools] Use inspector_protocol generator in content/browser/devtools. (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_STRING_H
6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_STRING_H
7
8 #include <memory>
9 #include <string>
10
11 #include "base/logging.h"
12 #include "base/macros.h"
13 #include "base/strings/string_number_conversions.h"
14 #include "content/common/content_export.h"
15
16 namespace content {
17
18 class CONTENT_EXPORT ProtocolStringBuilder {
caseq 2016/11/12 02:17:04 perhaps get it into protocol or otherwise avoid ex
dgozman 2016/11/14 18:40:28 Done.
19 public:
20 ProtocolStringBuilder();
21 ~ProtocolStringBuilder();
22 void append(const std::string&);
23 void append(char);
24 void append(const char*, size_t);
25 std::string toString();
26 void reserveCapacity(size_t);
27
28 private:
29 std::vector<char> buffer_;
caseq 2016/11/12 02:17:04 let's just += a string.
dgozman 2016/11/14 18:40:28 Done.
30 };
31
32 namespace protocol {
33
34 class Value;
35
36 using String = std::string;
37 using StringBuilder = ProtocolStringBuilder;
38
39 class CONTENT_EXPORT StringUtil {
40 public:
41 static String substring(const String& s, unsigned pos, unsigned len) {
42 return s.substr(pos, len);
43 }
44 static String fromInteger(int number) {
45 return base::IntToString(number);
46 }
47 static String fromDouble(double number) {
48 return base::DoubleToString(number);
49 }
50 static const size_t kNotFound = static_cast<size_t>(-1);
51 static void builderReserve(StringBuilder& builder, unsigned capacity) {
52 builder.reserveCapacity(capacity);
53 }
54 static std::unique_ptr<protocol::Value> parseJSON(const String&);
55 };
56
57 } // namespace protocol
58 } // namespace content
59
60 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_STRING_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698