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

Side by Side Diff: src/inspector/string-16.h

Issue 2332163002: [inspector] fixed all shorten-64-to-32 warnings (Closed)
Patch Set: rebased Created 4 years, 2 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/search-util.cc ('k') | src/inspector/string-16.cc » ('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 V8 project authors. All rights reserved. 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 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 V8_INSPECTOR_STRING16_H_ 5 #ifndef V8_INSPECTOR_STRING16_H_
6 #define V8_INSPECTOR_STRING16_H_ 6 #define V8_INSPECTOR_STRING16_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <cctype> 9 #include <cctype>
10 #include <climits> 10 #include <climits>
(...skipping 14 matching lines...) Expand all
25 String16(const UChar* characters, size_t size) : m_impl(characters, size) {} 25 String16(const UChar* characters, size_t size) : m_impl(characters, size) {}
26 String16(const UChar* characters) : m_impl(characters) {} 26 String16(const UChar* characters) : m_impl(characters) {}
27 String16(const char* characters) 27 String16(const char* characters)
28 : String16(characters, std::strlen(characters)) {} 28 : String16(characters, std::strlen(characters)) {}
29 String16(const char* characters, size_t size) { 29 String16(const char* characters, size_t size) {
30 m_impl.resize(size); 30 m_impl.resize(size);
31 for (size_t i = 0; i < size; ++i) m_impl[i] = characters[i]; 31 for (size_t i = 0; i < size; ++i) m_impl[i] = characters[i];
32 } 32 }
33 33
34 static String16 fromInteger(int); 34 static String16 fromInteger(int);
35 static String16 fromInteger(size_t);
35 static String16 fromDouble(double); 36 static String16 fromDouble(double);
36 static String16 fromDoublePrecision3(double); 37 static String16 fromDoublePrecision3(double);
37 static String16 fromDoublePrecision6(double); 38 static String16 fromDoublePrecision6(double);
38 39
39 int toInteger(bool* ok = nullptr) const; 40 int toInteger(bool* ok = nullptr) const;
40 String16 stripWhiteSpace() const; 41 String16 stripWhiteSpace() const;
41 const UChar* characters16() const { return m_impl.c_str(); } 42 const UChar* characters16() const { return m_impl.c_str(); }
42 size_t length() const { return m_impl.length(); } 43 size_t length() const { return m_impl.length(); }
43 bool isEmpty() const { return !m_impl.length(); } 44 bool isEmpty() const { return !m_impl.length(); }
44 UChar operator[](unsigned index) const { return m_impl[index]; } 45 UChar operator[](size_t index) const { return m_impl[index]; }
45 String16 substring(unsigned pos, unsigned len = UINT_MAX) const { 46 String16 substring(size_t pos, size_t len = UINT_MAX) const {
46 return String16(m_impl.substr(pos, len)); 47 return String16(m_impl.substr(pos, len));
47 } 48 }
48 size_t find(const String16& str, unsigned start = 0) const { 49 size_t find(const String16& str, size_t start = 0) const {
49 return m_impl.find(str.m_impl, start); 50 return m_impl.find(str.m_impl, start);
50 } 51 }
51 size_t reverseFind(const String16& str, unsigned start = UINT_MAX) const { 52 size_t reverseFind(const String16& str, size_t start = UINT_MAX) const {
52 return m_impl.rfind(str.m_impl, start); 53 return m_impl.rfind(str.m_impl, start);
53 } 54 }
54 void swap(String16& other) { m_impl.swap(other.m_impl); } 55 void swap(String16& other) { m_impl.swap(other.m_impl); }
55 56
56 // Convenience methods. 57 // Convenience methods.
57 std::string utf8() const; 58 std::string utf8() const;
58 static String16 fromUTF8(const char* stringStart, size_t length); 59 static String16 fromUTF8(const char* stringStart, size_t length);
59 60
60 const std::basic_string<UChar>& impl() const { return m_impl; } 61 const std::basic_string<UChar>& impl() const { return m_impl; }
61 explicit String16(const std::basic_string<UChar>& impl) : m_impl(impl) {} 62 explicit String16(const std::basic_string<UChar>& impl) : m_impl(impl) {}
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 std::size_t operator()(const v8_inspector::String16& string) const { 124 std::size_t operator()(const v8_inspector::String16& string) const {
124 return string.hash(); 125 return string.hash();
125 } 126 }
126 }; 127 };
127 128
128 } // namespace std 129 } // namespace std
129 130
130 #endif // !defined(__APPLE__) || defined(_LIBCPP_VERSION) 131 #endif // !defined(__APPLE__) || defined(_LIBCPP_VERSION)
131 132
132 #endif // V8_INSPECTOR_STRING16_H_ 133 #endif // V8_INSPECTOR_STRING16_H_
OLDNEW
« no previous file with comments | « src/inspector/search-util.cc ('k') | src/inspector/string-16.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698