OLD | NEW |
(Empty) | |
| 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 protocol_{{domain.domain}}_imported_h |
| 8 #define protocol_{{domain.domain}}_imported_h |
| 9 |
| 10 #include "platform/inspector_protocol/ErrorSupport.h" |
| 11 #include "platform/inspector_protocol/ValueConversions.h" |
| 12 #include "platform/inspector_protocol/Values.h" |
| 13 #include "{{include_package}}/{{domain.domain}}.h" |
| 14 |
| 15 namespace blink { |
| 16 namespace protocol { |
| 17 {% for type in domain.types %} |
| 18 {% if not (type.type == "object") or not ("properties" in type) or not (type
.exported) %}{% continue %}{% endif %} |
| 19 |
| 20 template<> |
| 21 struct ValueConversions<{{domain.domain}}::API::{{type.id}}> { |
| 22 static std::unique_ptr<{{domain.domain}}::API::{{type.id}}> parse(protocol::
Value* value, ErrorSupport* errors) |
| 23 { |
| 24 if (!value) { |
| 25 errors->addError("value expected"); |
| 26 return nullptr; |
| 27 } |
| 28 std::unique_ptr<{{domain.domain}}::API::{{type.id}}> result = {{domain.d
omain}}::API::{{type.id}}::fromJSONString(value->toJSONString()); |
| 29 if (!result) |
| 30 errors->addError("cannot parse"); |
| 31 return result; |
| 32 } |
| 33 |
| 34 static std::unique_ptr<protocol::Value> serialize({{domain.domain}}::API::{{
type.id}}* value) |
| 35 { |
| 36 return SerializedValue::create(value->toJSONString()); |
| 37 } |
| 38 |
| 39 static std::unique_ptr<protocol::Value> serialize(const std::unique_ptr<{{do
main.domain}}::API::{{type.id}}>& value) |
| 40 { |
| 41 return SerializedValue::create(value->toJSONString()); |
| 42 } |
| 43 }; |
| 44 {% endfor %} |
| 45 |
| 46 } // namespace protocol |
| 47 } // namespace blink |
| 48 |
| 49 #endif // !defined(protocol_{{domain.domain}}_imported_h) |
OLD | NEW |