| OLD | NEW |
| 1 // This file is generated | 1 // This file is generated |
| 2 | 2 |
| 3 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 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 | 4 // Use of this source code is governed by a BSD-style license that can be |
| 5 // found in the LICENSE file. | 5 // found in the LICENSE file. |
| 6 | 6 |
| 7 #ifndef {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_imported_h | 7 #ifndef {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_imported_h |
| 8 #define {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_imported_h | 8 #define {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_imported_h |
| 9 | 9 |
| 10 #include {{format_include(config.protocol.package, "Protocol")}} | 10 #include {{format_include(config.protocol.package, "Protocol")}} |
| 11 {% if config.imported.header %} | 11 {% if config.imported.header %} |
| 12 #include {{format_include(config.imported.header)}} | 12 #include {{format_include(config.imported.header)}} |
| 13 {% else %} | 13 {% else %} |
| 14 #include {{format_include(config.imported.package, domain.domain)}} | 14 #include {{format_include(config.imported.package, domain.domain)}} |
| 15 {% endif %} | 15 {% endif %} |
| 16 | 16 |
| 17 {% for namespace in config.protocol.namespace %} | 17 {% for namespace in config.protocol.namespace %} |
| 18 namespace {{namespace}} { | 18 namespace {{namespace}} { |
| 19 {% endfor %} | 19 {% endfor %} |
| 20 {% for type in domain.types %} | 20 {% for type in domain.types %} |
| 21 {% if not (type.type == "object") or not ("properties" in type) or not (type
.exported) %}{% continue %}{% endif %} | 21 {% if not (type.type == "object") or not ("properties" in type) or not proto
col.is_imported(domain.domain, type.id) %}{% continue %}{% endif %} |
| 22 | 22 |
| 23 template<> | 23 template<> |
| 24 struct ValueConversions<{{"::".join(config.imported.namespace)}}::{{domain.domai
n}}::API::{{type.id}}> { | 24 struct ValueConversions<{{"::".join(config.imported.namespace)}}::{{domain.domai
n}}::API::{{type.id}}> { |
| 25 static std::unique_ptr<{{"::".join(config.imported.namespace)}}::{{domain.do
main}}::API::{{type.id}}> fromValue(protocol::Value* value, ErrorSupport* errors
) | 25 static std::unique_ptr<{{"::".join(config.imported.namespace)}}::{{domain.do
main}}::API::{{type.id}}> fromValue(protocol::Value* value, ErrorSupport* errors
) |
| 26 { | 26 { |
| 27 if (!value) { | 27 if (!value) { |
| 28 errors->addError("value expected"); | 28 errors->addError("value expected"); |
| 29 return nullptr; | 29 return nullptr; |
| 30 } | 30 } |
| 31 String json = value->serialize(); | 31 String json = value->serialize(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 46 return toValue(value.get()); | 46 return toValue(value.get()); |
| 47 } | 47 } |
| 48 }; | 48 }; |
| 49 {% endfor %} | 49 {% endfor %} |
| 50 | 50 |
| 51 {% for namespace in config.protocol.namespace %} | 51 {% for namespace in config.protocol.namespace %} |
| 52 } // namespace {{namespace}} | 52 } // namespace {{namespace}} |
| 53 {% endfor %} | 53 {% endfor %} |
| 54 | 54 |
| 55 #endif // !defined({{"_".join(config.protocol.namespace)}}_{{domain.domain}}_imp
orted_h) | 55 #endif // !defined({{"_".join(config.protocol.namespace)}}_{{domain.domain}}_imp
orted_h) |
| OLD | NEW |