|
| 1 | +// This file is generated |
| 2 | + |
| 3 | +// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 4 | +// Use of this source code is governed by a BSD-style license that can be |
| 5 | +// found in the LICENSE file. |
| 6 | + |
| 7 | +#ifndef v8_inspector_protocol_GenericTypes_h |
| 8 | +#define v8_inspector_protocol_GenericTypes_h |
| 9 | + |
| 10 | +#include "src/inspector/protocol/Protocol.h" |
| 11 | +// For each imported domain we generate a ValueConversions struct instead of a full domain definition |
| 12 | +// and include Domain::API version from there. |
| 13 | + |
| 14 | +namespace v8_inspector { |
| 15 | +namespace protocol { |
| 16 | +namespace GenericTypes { |
| 17 | + |
| 18 | +// ------------- Forward and enum declarations. |
| 19 | +// Search match in a resource. |
| 20 | +class SearchMatch; |
| 21 | + |
| 22 | +// ------------- Type and builder declarations. |
| 23 | + |
| 24 | +// Search match in a resource. |
| 25 | +class SearchMatch { |
| 26 | + PROTOCOL_DISALLOW_COPY(SearchMatch); |
| 27 | + public: |
| 28 | + static std::unique_ptr<SearchMatch> parse(protocol::Value* value, ErrorSupport* errors); |
| 29 | + |
| 30 | + ~SearchMatch() { } |
| 31 | + |
| 32 | + double getLineNumber() { |
| 33 | + return m_lineNumber; |
| 34 | + } |
| 35 | + void setLineNumber(double value) { |
| 36 | + m_lineNumber = value; |
| 37 | + } |
| 38 | + |
| 39 | + String getLineContent() { |
| 40 | + return m_lineContent; |
| 41 | + } |
| 42 | + void setLineContent(const String& value) { |
| 43 | + m_lineContent = value; |
| 44 | + } |
| 45 | + |
| 46 | + std::unique_ptr<protocol::DictionaryValue> serialize() const; |
| 47 | + std::unique_ptr<SearchMatch> clone() const; |
| 48 | + |
| 49 | + template<int STATE> |
| 50 | + class SearchMatchBuilder { |
| 51 | + public: |
| 52 | + enum { |
| 53 | + NoFieldsSet = 0, |
| 54 | + LineNumberSet = 1 << 1, |
| 55 | + LineContentSet = 1 << 2, |
| 56 | + AllFieldsSet = (LineNumberSet | LineContentSet | 0) |
| 57 | + }; |
| 58 | + |
| 59 | + |
| 60 | + SearchMatchBuilder<STATE | LineNumberSet>& setLineNumber(double value) { |
| 61 | + static_assert(!(STATE & LineNumberSet), "property lineNumber should not be set yet"); |
| 62 | + m_result->setLineNumber(value); |
| 63 | + return castState<LineNumberSet>(); |
| 64 | + } |
| 65 | + |
| 66 | + SearchMatchBuilder<STATE | LineContentSet>& setLineContent(const String& value) { |
| 67 | + static_assert(!(STATE & LineContentSet), "property lineContent should not be set yet"); |
| 68 | + m_result->setLineContent(value); |
| 69 | + return castState<LineContentSet>(); |
| 70 | + } |
| 71 | + |
| 72 | + std::unique_ptr<SearchMatch> build() { |
| 73 | + static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet"); |
| 74 | + return std::move(m_result); |
| 75 | + } |
| 76 | + |
| 77 | + private: |
| 78 | + friend class SearchMatch; |
| 79 | + SearchMatchBuilder() : m_result(new SearchMatch()) { } |
| 80 | + |
| 81 | + template<int STEP> SearchMatchBuilder<STATE | STEP>& castState() { |
| 82 | + return *reinterpret_cast<SearchMatchBuilder<STATE | STEP>*>(this); |
| 83 | + } |
| 84 | + |
| 85 | + std::unique_ptr<protocol::GenericTypes::SearchMatch> m_result; |
| 86 | + }; |
| 87 | + |
| 88 | + static SearchMatchBuilder<0> create() { |
| 89 | + return SearchMatchBuilder<0>(); |
| 90 | + } |
| 91 | + |
| 92 | + private: |
| 93 | + SearchMatch() { |
| 94 | + m_lineNumber = 0; |
| 95 | + } |
| 96 | + |
| 97 | + double m_lineNumber; |
| 98 | + String m_lineContent; |
| 99 | +}; |
| 100 | + |
| 101 | + |
| 102 | +// ------------- Backend interface. |
| 103 | + |
| 104 | +class Backend { |
| 105 | + public: |
| 106 | + virtual ~Backend() { } |
| 107 | + |
| 108 | + |
| 109 | + virtual void disable(ErrorString*) { } |
| 110 | +}; |
| 111 | + |
| 112 | +// ------------- Frontend interface. |
| 113 | + |
| 114 | +class Frontend { |
| 115 | + public: |
| 116 | + Frontend(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { } |
| 117 | + |
| 118 | + void flush(); |
| 119 | + private: |
| 120 | + FrontendChannel* m_frontendChannel; |
| 121 | +}; |
| 122 | + |
| 123 | +// ------------- Dispatcher. |
| 124 | + |
| 125 | +class Dispatcher { |
| 126 | + public: |
| 127 | + static void wire(UberDispatcher*, Backend*); |
| 128 | + |
| 129 | + private: |
| 130 | + Dispatcher() { } |
| 131 | +}; |
| 132 | + |
| 133 | +// ------------- Metainfo. |
| 134 | + |
| 135 | +class Metainfo { |
| 136 | + public: |
| 137 | + using BackendClass = Backend; |
| 138 | + using FrontendClass = Frontend; |
| 139 | + using DispatcherClass = Dispatcher; |
| 140 | + static const char domainName[]; |
| 141 | + static const char commandPrefix[]; |
| 142 | + static const char version[]; |
| 143 | +}; |
| 144 | + |
| 145 | +} // namespace GenericTypes |
| 146 | +} // namespace v8_inspector |
| 147 | +} // namespace protocol |
| 148 | + |
| 149 | +#endif // !defined(v8_inspector_protocol_GenericTypes_h) |
0 commit comments