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

Side by Side Diff: components/ui_devtools/string_util.h

Issue 2846113002: Roll third_party/inspector_protocol to efefa86c3183d307f0a0e53bf568fe57c5b58849 (Closed)
Patch Set: updated README.chromium Created 3 years, 7 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 | « no previous file | content/browser/devtools/protocol_string.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 COMPONENTS_UI_DEVTOOLS_STRING_UTIL_H_ 5 #ifndef COMPONENTS_UI_DEVTOOLS_STRING_UTIL_H_
6 #define COMPONENTS_UI_DEVTOOLS_STRING_UTIL_H_ 6 #define COMPONENTS_UI_DEVTOOLS_STRING_UTIL_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 27 matching lines...) Expand all
38 38
39 class StringUtil { 39 class StringUtil {
40 public: 40 public:
41 static String substring(const String& s, unsigned pos, unsigned len) { 41 static String substring(const String& s, unsigned pos, unsigned len) {
42 return s.substr(pos, len); 42 return s.substr(pos, len);
43 } 43 }
44 static String fromInteger(int number) { return base::IntToString(number); } 44 static String fromInteger(int number) { return base::IntToString(number); }
45 static String fromDouble(double number) { 45 static String fromDouble(double number) {
46 return base::DoubleToString(number); 46 return base::DoubleToString(number);
47 } 47 }
48 static double toDouble(const char* s, size_t len, bool* ok) {
49 double v = 0.0;
50 *ok = base::StringToDouble(std::string(s, len), &v);
51 return *ok ? v : 0.0;
52 }
48 static void builderAppend(StringBuilder& builder, const String& s) { 53 static void builderAppend(StringBuilder& builder, const String& s) {
49 builder.append(s); 54 builder.append(s);
50 } 55 }
51 static void builderAppend(StringBuilder& builder, char c) { 56 static void builderAppend(StringBuilder& builder, char c) {
52 builder.append(c); 57 builder.append(c);
53 } 58 }
54 static void builderAppend(StringBuilder& builder, const char* s, size_t len) { 59 static void builderAppend(StringBuilder& builder, const char* s, size_t len) {
55 builder.append(s, len); 60 builder.append(s, len);
56 } 61 }
57 static void builderReserve(StringBuilder& builder, unsigned capacity) { 62 static void builderReserve(StringBuilder& builder, unsigned capacity) {
(...skipping 10 matching lines...) Expand all
68 } 73 }
69 static const size_t kNotFound = static_cast<size_t>(-1); 74 static const size_t kNotFound = static_cast<size_t>(-1);
70 static std::unique_ptr<Value> parseJSON(const String& string); 75 static std::unique_ptr<Value> parseJSON(const String& string);
71 }; 76 };
72 77
73 } // namespace protocol 78 } // namespace protocol
74 } // namespace devtools 79 } // namespace devtools
75 } // namespace ui 80 } // namespace ui
76 81
77 #endif // COMPONENTS_UI_DEVTOOLS_STRING_UTIL_H_ 82 #endif // COMPONENTS_UI_DEVTOOLS_STRING_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/devtools/protocol_string.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698