OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_BROWSER_DEVTOOLS_PROTOCOL_STRING_H | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_STRING_H |
6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_STRING_H | 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_STRING_H |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 static String fromInteger(int number) { | 46 static String fromInteger(int number) { |
47 return base::IntToString(number); | 47 return base::IntToString(number); |
48 } | 48 } |
49 static String fromDouble(double number) { | 49 static String fromDouble(double number) { |
50 String s = base::DoubleToString(number); | 50 String s = base::DoubleToString(number); |
51 if (!s.empty() && s[0] == '.') | 51 if (!s.empty() && s[0] == '.') |
52 s = "0" + s; | 52 s = "0" + s; |
53 return s; | 53 return s; |
54 } | 54 } |
55 static const size_t kNotFound = static_cast<size_t>(-1); | 55 static const size_t kNotFound = static_cast<size_t>(-1); |
| 56 static void builderAppend(StringBuilder& builder, const String& s) { |
| 57 builder.append(s); |
| 58 } |
| 59 static void builderAppend(StringBuilder& builder, char c) { |
| 60 builder.append(c); |
| 61 } |
| 62 static void builderAppend(StringBuilder& builder, const char* s, size_t len) { |
| 63 builder.append(s, len); |
| 64 } |
56 static void builderReserve(StringBuilder& builder, unsigned capacity) { | 65 static void builderReserve(StringBuilder& builder, unsigned capacity) { |
57 builder.reserveCapacity(capacity); | 66 builder.reserveCapacity(capacity); |
58 } | 67 } |
| 68 static String builderToString(StringBuilder& builder) { |
| 69 return builder.toString(); |
| 70 } |
59 static std::unique_ptr<protocol::Value> parseJSON(const String&); | 71 static std::unique_ptr<protocol::Value> parseJSON(const String&); |
60 }; | 72 }; |
61 | 73 |
62 std::unique_ptr<protocol::Value> toProtocolValue( | 74 std::unique_ptr<protocol::Value> toProtocolValue( |
63 const base::Value* value, int depth); | 75 const base::Value* value, int depth); |
64 std::unique_ptr<base::Value> toBaseValue(protocol::Value* value, int depth); | 76 std::unique_ptr<base::Value> toBaseValue(protocol::Value* value, int depth); |
65 | 77 |
66 } // namespace protocol | 78 } // namespace protocol |
67 } // namespace content | 79 } // namespace content |
68 | 80 |
69 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_STRING_H | 81 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_STRING_H |
OLD | NEW |