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

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

Issue 2899783002: Move DevTools out of ash and turn it to a component. (Closed)
Patch Set: NON_EXPORTED_BASE base class Created 3 years, 6 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
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 10 matching lines...) Expand all
21 21
22 class CustomStringBuilder { 22 class CustomStringBuilder {
23 String s_; 23 String s_;
24 24
25 public: 25 public:
26 CustomStringBuilder() {} 26 CustomStringBuilder() {}
27 CustomStringBuilder(String& s) : s_(s) {} 27 CustomStringBuilder(String& s) : s_(s) {}
28 void reserveCapacity(std::size_t size) { s_.reserve(size); } 28 void reserveCapacity(std::size_t size) { s_.reserve(size); }
29 void append(const String& s) { s_ += s; } 29 void append(const String& s) { s_ += s; }
30 void append(char c) { s_ += c; } 30 void append(char c) { s_ += c; }
31 void append(const char* data, unsigned int length) { 31 void append(const char* data, size_t length) { s_.append(data, length); }
32 s_.append(data, length);
33 }
34 String toString() { return s_; } 32 String toString() { return s_; }
35 }; 33 };
36 34
37 using StringBuilder = CustomStringBuilder; 35 using StringBuilder = CustomStringBuilder;
38 36
39 class StringUtil { 37 class StringUtil {
40 public: 38 public:
41 static String substring(const String& s, unsigned pos, unsigned len) { 39 static String substring(const String& s, unsigned pos, unsigned len) {
42 return s.substr(pos, len); 40 return s.substr(pos, len);
43 } 41 }
(...skipping 29 matching lines...) Expand all
73 } 71 }
74 static const size_t kNotFound = static_cast<size_t>(-1); 72 static const size_t kNotFound = static_cast<size_t>(-1);
75 static std::unique_ptr<Value> parseJSON(const String& string); 73 static std::unique_ptr<Value> parseJSON(const String& string);
76 }; 74 };
77 75
78 } // namespace protocol 76 } // namespace protocol
79 } // namespace devtools 77 } // namespace devtools
80 } // namespace ui 78 } // namespace ui
81 79
82 #endif // COMPONENTS_UI_DEVTOOLS_STRING_UTIL_H_ 80 #endif // COMPONENTS_UI_DEVTOOLS_STRING_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698