Chromium Code Reviews| Index: third_party/WebKit/Source/platform/v8_inspector/public/String.h |
| diff --git a/third_party/WebKit/Source/platform/v8_inspector/public/String.h b/third_party/WebKit/Source/platform/v8_inspector/public/String.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bd7227dbf308dbf3272ee81c34747bc481f6130b |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/platform/v8_inspector/public/String.h |
| @@ -0,0 +1,45 @@ |
| +// 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 String_h |
| +#define String_h |
| + |
| +#include "platform/PlatformExport.h" |
| + |
| +#include <cctype> |
| +#include <memory> |
| +#include <stdint.h> |
| + |
| +namespace v8_inspector { |
| + |
| +class PLATFORM_EXPORT StringView { |
| +public: |
| + StringView() : m_is8Bit(true), m_length(0) { m_characters8 = nullptr; } |
| + StringView(const uint8_t* characters, unsigned length) : m_is8Bit(true), m_length(length) { m_characters8 = characters; } |
| + StringView(const uint16_t* characters, unsigned length) : m_is8Bit(false), m_length(length) { m_characters16 = characters; } |
| + |
| + bool is8Bit() const { return m_is8Bit; } |
| + unsigned length() const { return m_length; } |
| + const uint8_t* characters8() const { return m_characters8; } |
| + const uint16_t* characters16() const { return m_characters16; } |
| + |
| +private: |
| + bool m_is8Bit; |
| + unsigned m_length; |
| + union { |
| + const uint8_t* m_characters8; |
| + const uint16_t* m_characters16; |
| + }; |
| +}; |
| + |
| +class PLATFORM_EXPORT StringBuffer { |
| +public: |
| + // This method copies contents. |
| + static std::unique_ptr<StringBuffer> create(const StringView&); |
| + virtual const StringView& string() = 0; |
|
caseq
2016/08/22 17:53:02
You're not hiding StringView, right? So this could
dgozman
2016/08/22 22:35:19
I'd prefer to make this pure virtual.
|
| +}; |
| + |
| +} // namespace v8_inspector |
| + |
| +#endif // String_h |