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}}_h | 7 #ifndef {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_h |
8 #define {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_h | 8 #define {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_h |
9 | 9 |
10 {% if config.protocol.export_header %} | 10 {% if config.protocol.export_header %} |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 | 82 |
83 struct {{config.protocol.export_macro}} {{property.name | to_title_case}}Enu m { | 83 struct {{config.protocol.export_macro}} {{property.name | to_title_case}}Enu m { |
84 {% for literal in property.enum %} | 84 {% for literal in property.enum %} |
85 static const char* {{literal | dash_to_camelcase}}; | 85 static const char* {{literal | dash_to_camelcase}}; |
86 {% endfor %} | 86 {% endfor %} |
87 }; // {{property.name | to_title_case}}Enum | 87 }; // {{property.name | to_title_case}}Enum |
88 {% endif %} | 88 {% endif %} |
89 | 89 |
90 {% if property.optional %} | 90 {% if property.optional %} |
91 bool has{{property.name | to_title_case}}() { return m_{{property.name}}.isJ ust(); } | 91 bool has{{property.name | to_title_case}}() { return m_{{property.name}}.isJ ust(); } |
92 {{resolve_type(property).raw_return_type}} get{{property.name | to_title_cas e}}({{resolve_type(property).raw_pass_type}} defaultValue) { return m_{{property .name}}.isJust() ? m_{{property.name}}.fromJust() : defaultValue; } | 92 {{resolve_type(property).raw_return_type}} get{{property.name | to_title_cas e}}({{resolve_type(property).raw_pass_type}} defaultValue) const { return m_{{pr operty.name}}.isJust() ? m_{{property.name}}.fromJust() : defaultValue; } |
93 {% else %} | 93 {% else %} |
94 {{resolve_type(property).raw_return_type}} get{{property.name | to_title_cas e}}() { return {{resolve_type(property).to_raw_type % ("m_" + property.name)}}; } | 94 const {{resolve_type(property).return_type}}& get{{property.name | to_title_ case}}() const { return {{"m_" + property.name}}; } |
dgozman
2016/10/12 21:00:40
Could you please describe why this change is neede
alex clarke (OOO till 29th)
2016/10/13 20:25:10
Before my change it returned the object by value i
dgozman
2016/10/14 01:32:33
- Note that Strings are cheap in blink - they are
| |
95 {% endif %} | 95 {% endif %} |
96 void set{{property.name | to_title_case}}({{resolve_type(property).pass_type }} value) { m_{{property.name}} = {{resolve_type(property).to_rvalue % "value"}} ; } | 96 void set{{property.name | to_title_case}}({{resolve_type(property).pass_type }} value) { m_{{property.name}} = {{resolve_type(property).to_rvalue % "value"}} ; } |
97 {% endfor %} | 97 {% endfor %} |
98 | 98 |
99 std::unique_ptr<protocol::DictionaryValue> serialize() const; | 99 std::unique_ptr<protocol::DictionaryValue> serialize() const; |
100 std::unique_ptr<{{type.id}}> clone() const; | 100 std::unique_ptr<{{type.id}}> clone() const; |
101 {% if type.exported %} | 101 {% if type.exported %} |
102 {{config.exported.string_out}} toJSONString() const override; | 102 {{config.exported.string_out}} toJSONString() const override; |
103 {% endif %} | 103 {% endif %} |
104 | 104 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 static const char commandPrefix[]; | 281 static const char commandPrefix[]; |
282 static const char version[]; | 282 static const char version[]; |
283 }; | 283 }; |
284 | 284 |
285 } // namespace {{domain.domain}} | 285 } // namespace {{domain.domain}} |
286 {% for namespace in config.protocol.namespace %} | 286 {% for namespace in config.protocol.namespace %} |
287 } // namespace {{namespace}} | 287 } // namespace {{namespace}} |
288 {% endfor %} | 288 {% endfor %} |
289 | 289 |
290 #endif // !defined({{"_".join(config.protocol.namespace)}}_{{domain.domain}}_h) | 290 #endif // !defined({{"_".join(config.protocol.namespace)}}_{{domain.domain}}_h) |
OLD | NEW |