| 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 {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_api_h | |
| 8 #define {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_api_h | |
| 9 | |
| 10 #include "{{config.class_export.header}}" | |
| 11 #include "{{config.exported.string_header}}" | |
| 12 | |
| 13 {% for namespace in config.protocol.namespace %} | |
| 14 namespace {{namespace}} { | |
| 15 {% endfor %} | |
| 16 namespace {{domain.domain}} { | |
| 17 namespace API { | |
| 18 | |
| 19 // ------------- Enums. | |
| 20 {% for type in domain.types %} | |
| 21 {% if ("enum" in type) and type.exported %} | |
| 22 | |
| 23 namespace {{type.id}}Enum { | |
| 24 {% for literal in type.enum %} | |
| 25 {{config.class_export.macro}} extern const char* {{ literal | dash_to_camelcase}
}; | |
| 26 {% endfor %} | |
| 27 } // {{type.id}}Enum | |
| 28 {% endif %} | |
| 29 {% endfor %} | |
| 30 {% for command in join_arrays(domain, ["commands", "events"]) %} | |
| 31 {% for param in join_arrays(command, ["parameters", "returns"]) %} | |
| 32 {% if ("enum" in param) and (param.exported) %} | |
| 33 | |
| 34 namespace {{command.name | to_title_case}} { | |
| 35 namespace {{param.name | to_title_case}}Enum { | |
| 36 {% for literal in param.enum %} | |
| 37 {{config.class_export.macro}} extern const char* {{ literal | dash_to_camelcase}
}; | |
| 38 {% endfor %} | |
| 39 } // {{param.name | to_title_case}}Enum | |
| 40 } // {{command.name | to_title_case }} | |
| 41 {% endif %} | |
| 42 {% endfor %} | |
| 43 {% endfor %} | |
| 44 | |
| 45 // ------------- Types. | |
| 46 {% for type in domain.types %} | |
| 47 {% if not (type.type == "object") or not ("properties" in type) or not (type
.exported) %}{% continue %}{% endif %} | |
| 48 | |
| 49 class {{config.class_export.macro}} {{type.id}} { | |
| 50 public: | |
| 51 virtual {{config.exported.string_out}} toJSONString() const = 0; | |
| 52 virtual ~{{type.id}}() { } | |
| 53 static std::unique_ptr<protocol::{{domain.domain}}::API::{{type.id}}> fromJS
ONString(const {{config.exported.string_in}}& json); | |
| 54 }; | |
| 55 {% endfor %} | |
| 56 | |
| 57 } // namespace API | |
| 58 } // namespace {{domain.domain}} | |
| 59 {% for namespace in config.protocol.namespace %} | |
| 60 } // namespace {{namespace}} | |
| 61 {% endfor %} | |
| 62 | |
| 63 #endif // !defined({{"_".join(config.protocol.namespace)}}_{{domain.domain}}_api
_h) | |
| OLD | NEW |