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

Unified Diff: third_party/WebKit/Source/platform/inspector_protocol/String16STL.h

Issue 2238423002: [DevTools] Generate all files in inspector_protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2240663003
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/inspector_protocol/String16STL.h
diff --git a/third_party/WebKit/Source/platform/inspector_protocol/String16STL.h b/third_party/WebKit/Source/platform/inspector_protocol/String16STL.h
deleted file mode 100644
index 8c8bba84415293277a9ebd1048827b73ced81c58..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/platform/inspector_protocol/String16STL.h
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef String16STL_h
-#define String16STL_h
-
-#include <cctype>
-#include <cstdlib>
-#include <cstring>
-#include <stdint.h>
-#include <string>
-#include <vector>
-
-using UChar = uint16_t;
-
-namespace blink {
-namespace protocol {
-
-class String16 : public String16Base<String16, UChar> {
-public:
- static const size_t kNotFound = static_cast<size_t>(-1);
-
- String16() { }
- String16(const String16& other) : m_impl(other.m_impl) { }
- String16(const UChar* characters, size_t size) : m_impl(characters, size) { }
- String16(const UChar* characters) : m_impl(characters) { }
- String16(const char* characters) : String16(characters, std::strlen(characters)) { }
- String16(const char* characters, size_t size)
- {
- m_impl.resize(size);
- for (size_t i = 0; i < size; ++i)
- m_impl[i] = characters[i];
- }
-
- String16 isolatedCopy() const { return String16(m_impl); }
- const UChar* characters16() const { return m_impl.c_str(); }
- size_t length() const { return m_impl.length(); }
- bool isEmpty() const { return !m_impl.length(); }
- UChar operator[](unsigned index) const { return m_impl[index]; }
- String16 substring(unsigned pos, unsigned len = 0xFFFFFFFF) const { return String16(m_impl.substr(pos, len)); }
- size_t find(const String16& str, unsigned start = 0) const { return m_impl.find(str.m_impl, start); }
- size_t reverseFind(const String16& str, unsigned start = 0xFFFFFFFF) const { return m_impl.rfind(str.m_impl, start); }
-
- // Convenience methods.
- std::string utf8() const;
- static String16 fromUTF8(const char* stringStart, size_t length);
-
- const std::basic_string<UChar>& impl() const { return m_impl; }
- explicit String16(const std::basic_string<UChar>& impl) : m_impl(impl) { }
-
- std::size_t hash() const
- {
- if (!has_hash) {
- size_t hash = 0;
- for (size_t i = 0; i < length(); ++i)
- hash = 31 * hash + m_impl[i];
- hash_code = hash;
- has_hash = true;
- }
- return hash_code;
- }
-
-private:
- std::basic_string<UChar> m_impl;
- mutable bool has_hash = false;
- mutable std::size_t hash_code = 0;
-};
-
-inline bool operator==(const String16& a, const String16& b) { return a.impl() == b.impl(); }
-inline bool operator!=(const String16& a, const String16& b) { return a.impl() != b.impl(); }
-inline bool operator==(const String16& a, const char* b) { return a.impl() == String16(b).impl(); }
-inline String16 operator+(const String16& a, const char* b) { return String16(a.impl() + String16(b).impl()); }
-inline String16 operator+(const char* a, const String16& b) { return String16(String16(a).impl() + b.impl()); }
-inline String16 operator+(const String16& a, const String16& b) { return String16(a.impl() + b.impl()); }
-
-} // namespace protocol
-} // namespace blink
-
-#if !defined(__APPLE__) || defined(_LIBCPP_VERSION)
-
-namespace std {
-template<> struct hash<blink::protocol::String16> {
- std::size_t operator()(const blink::protocol::String16& string) const
- {
- return string.hash();
- }
-};
-
-} // namespace std
-
-#endif // !defined(__APPLE__) || defined(_LIBCPP_VERSION)
-
-class InspectorProtocolConvenienceStringType {
-public:
- // This class should not be ever instantiated, so we don't implement constructors.
- InspectorProtocolConvenienceStringType();
- InspectorProtocolConvenienceStringType(const blink::protocol::String16& other);
- operator blink::protocol::String16() const { return blink::protocol::String16(); };
-};
-
-#endif // !defined(String16STL_h)

Powered by Google App Engine
This is Rietveld 408576698