LCOV - code coverage report
Current view: top level - out/Release/gen/src/inspector/protocol - Console.h (source / functions) Hit Total Coverage
Test: app.info Lines: 12 13 92.3 %
Date: 2017-04-26 Functions: 6 10 60.0 %

          Line data    Source code
       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_Console_h
       8             : #define v8_inspector_protocol_Console_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             : #include "src/inspector/protocol/Runtime.h"
      14             : 
      15             : namespace v8_inspector {
      16             : namespace protocol {
      17             : namespace Console {
      18             : 
      19             : // ------------- Forward and enum declarations.
      20             : // Console message.
      21             : class ConsoleMessage;
      22             : // Wrapper for notification params
      23             : class MessageAddedNotification;
      24             : 
      25             : // ------------- Type and builder declarations.
      26             : 
      27             : // Console message.
      28             : class  ConsoleMessage : public Serializable{
      29             :     PROTOCOL_DISALLOW_COPY(ConsoleMessage);
      30             : public:
      31             :     static std::unique_ptr<ConsoleMessage> fromValue(protocol::Value* value, ErrorSupport* errors);
      32             : 
      33          36 :     ~ConsoleMessage() override { }
      34             : 
      35             :     struct  SourceEnum {
      36             :         static const char* Xml;
      37             :         static const char* Javascript;
      38             :         static const char* Network;
      39             :         static const char* ConsoleApi;
      40             :         static const char* Storage;
      41             :         static const char* Appcache;
      42             :         static const char* Rendering;
      43             :         static const char* Security;
      44             :         static const char* Other;
      45             :         static const char* Deprecation;
      46             :         static const char* Worker;
      47             :     }; // SourceEnum
      48             : 
      49             :     String getSource() { return m_source; }
      50             :     void setSource(const String& value) { m_source = value; }
      51             : 
      52             :     struct  LevelEnum {
      53             :         static const char* Log;
      54             :         static const char* Warning;
      55             :         static const char* Error;
      56             :         static const char* Debug;
      57             :         static const char* Info;
      58             :     }; // LevelEnum
      59             : 
      60             :     String getLevel() { return m_level; }
      61             :     void setLevel(const String& value) { m_level = value; }
      62             : 
      63             :     String getText() { return m_text; }
      64             :     void setText(const String& value) { m_text = value; }
      65             : 
      66             :     bool hasUrl() { return m_url.isJust(); }
      67             :     String getUrl(const String& defaultValue) { return m_url.isJust() ? m_url.fromJust() : defaultValue; }
      68          24 :     void setUrl(const String& value) { m_url = value; }
      69             : 
      70             :     bool hasLine() { return m_line.isJust(); }
      71             :     int getLine(int defaultValue) { return m_line.isJust() ? m_line.fromJust() : defaultValue; }
      72             :     void setLine(int value) { m_line = value; }
      73             : 
      74             :     bool hasColumn() { return m_column.isJust(); }
      75             :     int getColumn(int defaultValue) { return m_column.isJust() ? m_column.fromJust() : defaultValue; }
      76             :     void setColumn(int value) { m_column = value; }
      77             : 
      78             :     std::unique_ptr<protocol::DictionaryValue> toValue() const;
      79           0 :     String serialize() override { return toValue()->serialize(); }
      80             :     std::unique_ptr<ConsoleMessage> clone() const;
      81             : 
      82             :     template<int STATE>
      83             :     class ConsoleMessageBuilder {
      84             :     public:
      85             :         enum {
      86             :             NoFieldsSet = 0,
      87             :           SourceSet = 1 << 1,
      88             :           LevelSet = 1 << 2,
      89             :           TextSet = 1 << 3,
      90             :             AllFieldsSet = (SourceSet | LevelSet | TextSet | 0)};
      91             : 
      92             : 
      93             :         ConsoleMessageBuilder<STATE | SourceSet>& setSource(const String& value)
      94             :         {
      95             :             static_assert(!(STATE & SourceSet), "property source should not be set yet");
      96             :             m_result->setSource(value);
      97             :             return castState<SourceSet>();
      98             :         }
      99             : 
     100             :         ConsoleMessageBuilder<STATE | LevelSet>& setLevel(const String& value)
     101             :         {
     102             :             static_assert(!(STATE & LevelSet), "property level should not be set yet");
     103             :             m_result->setLevel(value);
     104             :             return castState<LevelSet>();
     105             :         }
     106             : 
     107             :         ConsoleMessageBuilder<STATE | TextSet>& setText(const String& value)
     108             :         {
     109             :             static_assert(!(STATE & TextSet), "property text should not be set yet");
     110             :             m_result->setText(value);
     111             :             return castState<TextSet>();
     112             :         }
     113             : 
     114             :         ConsoleMessageBuilder<STATE>& setUrl(const String& value)
     115             :         {
     116             :             m_result->setUrl(value);
     117             :             return *this;
     118             :         }
     119             : 
     120             :         ConsoleMessageBuilder<STATE>& setLine(int value)
     121             :         {
     122             :             m_result->setLine(value);
     123             :             return *this;
     124             :         }
     125             : 
     126             :         ConsoleMessageBuilder<STATE>& setColumn(int value)
     127             :         {
     128             :             m_result->setColumn(value);
     129             :             return *this;
     130             :         }
     131             : 
     132             :         std::unique_ptr<ConsoleMessage> build()
     133             :         {
     134             :             static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
     135             :             return std::move(m_result);
     136             :         }
     137             : 
     138             :     private:
     139             :         friend class ConsoleMessage;
     140          24 :         ConsoleMessageBuilder() : m_result(new ConsoleMessage()) { }
     141             : 
     142             :         template<int STEP> ConsoleMessageBuilder<STATE | STEP>& castState()
     143             :         {
     144             :             return *reinterpret_cast<ConsoleMessageBuilder<STATE | STEP>*>(this);
     145             :         }
     146             : 
     147             :         std::unique_ptr<protocol::Console::ConsoleMessage> m_result;
     148             :     };
     149             : 
     150             :     static ConsoleMessageBuilder<0> create()
     151             :     {
     152          12 :         return ConsoleMessageBuilder<0>();
     153             :     }
     154             : 
     155             : private:
     156             :     ConsoleMessage()
     157          12 :     {
     158             :     }
     159             : 
     160             :     String m_source;
     161             :     String m_level;
     162             :     String m_text;
     163             :     Maybe<String> m_url;
     164             :     Maybe<int> m_line;
     165             :     Maybe<int> m_column;
     166             : };
     167             : 
     168             : 
     169             : // Wrapper for notification params
     170             : class  MessageAddedNotification : public Serializable{
     171             :     PROTOCOL_DISALLOW_COPY(MessageAddedNotification);
     172             : public:
     173             :     static std::unique_ptr<MessageAddedNotification> fromValue(protocol::Value* value, ErrorSupport* errors);
     174             : 
     175          24 :     ~MessageAddedNotification() override { }
     176             : 
     177             :     protocol::Console::ConsoleMessage* getMessage() { return m_message.get(); }
     178             :     void setMessage(std::unique_ptr<protocol::Console::ConsoleMessage> value) { m_message = std::move(value); }
     179             : 
     180             :     std::unique_ptr<protocol::DictionaryValue> toValue() const;
     181          36 :     String serialize() override { return toValue()->serialize(); }
     182             :     std::unique_ptr<MessageAddedNotification> clone() const;
     183             : 
     184             :     template<int STATE>
     185             :     class MessageAddedNotificationBuilder {
     186             :     public:
     187             :         enum {
     188             :             NoFieldsSet = 0,
     189             :           MessageSet = 1 << 1,
     190             :             AllFieldsSet = (MessageSet | 0)};
     191             : 
     192             : 
     193             :         MessageAddedNotificationBuilder<STATE | MessageSet>& setMessage(std::unique_ptr<protocol::Console::ConsoleMessage> value)
     194             :         {
     195             :             static_assert(!(STATE & MessageSet), "property message should not be set yet");
     196             :             m_result->setMessage(std::move(value));
     197             :             return castState<MessageSet>();
     198             :         }
     199             : 
     200             :         std::unique_ptr<MessageAddedNotification> build()
     201             :         {
     202             :             static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
     203             :             return std::move(m_result);
     204             :         }
     205             : 
     206             :     private:
     207             :         friend class MessageAddedNotification;
     208          12 :         MessageAddedNotificationBuilder() : m_result(new MessageAddedNotification()) { }
     209             : 
     210             :         template<int STEP> MessageAddedNotificationBuilder<STATE | STEP>& castState()
     211             :         {
     212             :             return *reinterpret_cast<MessageAddedNotificationBuilder<STATE | STEP>*>(this);
     213             :         }
     214             : 
     215             :         std::unique_ptr<protocol::Console::MessageAddedNotification> m_result;
     216             :     };
     217             : 
     218             :     static MessageAddedNotificationBuilder<0> create()
     219             :     {
     220             :         return MessageAddedNotificationBuilder<0>();
     221             :     }
     222             : 
     223             : private:
     224             :     MessageAddedNotification()
     225          12 :     {
     226             :     }
     227             : 
     228             :     std::unique_ptr<protocol::Console::ConsoleMessage> m_message;
     229             : };
     230             : 
     231             : 
     232             : // ------------- Backend interface.
     233             : 
     234        4573 : class  Backend {
     235             : public:
     236        4573 :     virtual ~Backend() { }
     237             : 
     238             :     virtual DispatchResponse enable() = 0;
     239             :     virtual DispatchResponse disable() = 0;
     240             :     virtual DispatchResponse clearMessages() = 0;
     241             : 
     242             : };
     243             : 
     244             : // ------------- Frontend interface.
     245             : 
     246             : class  Frontend {
     247             : public:
     248        4573 :     explicit Frontend(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { }
     249             :     void messageAdded(std::unique_ptr<protocol::Console::ConsoleMessage> message);
     250             : 
     251             :     void flush();
     252             :     void sendRawNotification(const String&);
     253             : private:
     254             :     FrontendChannel* m_frontendChannel;
     255             : };
     256             : 
     257             : // ------------- Dispatcher.
     258             : 
     259             : class  Dispatcher {
     260             : public:
     261             :     static void wire(UberDispatcher*, Backend*);
     262             : 
     263             : private:
     264             :     Dispatcher() { }
     265             : };
     266             : 
     267             : // ------------- Metainfo.
     268             : 
     269             : class  Metainfo {
     270             : public:
     271             :     using BackendClass = Backend;
     272             :     using FrontendClass = Frontend;
     273             :     using DispatcherClass = Dispatcher;
     274             :     static const char domainName[];
     275             :     static const char commandPrefix[];
     276             :     static const char version[];
     277             : };
     278             : 
     279             : } // namespace Console
     280             : } // namespace v8_inspector
     281             : } // namespace protocol
     282             : 
     283             : #endif // !defined(v8_inspector_protocol_Console_h)

Generated by: LCOV version 1.10