Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl

Issue 1618963006: Mojo C++ bindings: support enum validation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 {%- if variant -%} 5 {%- if variant -%}
6 {%- set variant_path = "%s-%s"|format(module.path, variant) -%} 6 {%- set variant_path = "%s-%s"|format(module.path, variant) -%}
7 {%- else -%} 7 {%- else -%}
8 {%- set variant_path = module.path -%} 8 {%- set variant_path = module.path -%}
9 {%- endif %} 9 {%- endif %}
10 10
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 {%- include "struct_definition.tmpl" %} 84 {%- include "struct_definition.tmpl" %}
85 {%- endfor %} 85 {%- endfor %}
86 86
87 {#--- Union definitions #} 87 {#--- Union definitions #}
88 {% for union in unions %} 88 {% for union in unions %}
89 {%- include "union_definition.tmpl" %} 89 {%- include "union_definition.tmpl" %}
90 {%- endfor %} 90 {%- endfor %}
91 91
92 } // namespace internal 92 } // namespace internal
93 93
94 {#--- Enums #}
95 {%- from "enum_macros.tmpl" import is_valid_enum_def -%}
96 {%- for enum in enums -%}
97 {{is_valid_enum_def(enum, class_name='')}}
98 {%- endfor %}
99
100 {#--- Struct Constants #} 94 {#--- Struct Constants #}
101 {%- for struct in structs %} 95 {%- for struct in structs %}
102 {%- for constant in struct.constants %} 96 {%- for constant in struct.constants %}
103 {%- if constant.kind|is_integral_kind %} 97 {%- if constant.kind|is_integral_kind %}
104 MOJO_STATIC_CONST_MEMBER_DEFINITION const {{constant.kind|cpp_pod_type}} {{struc t.name}}::{{constant.name}}; 98 MOJO_STATIC_CONST_MEMBER_DEFINITION const {{constant.kind|cpp_pod_type}} {{struc t.name}}::{{constant.name}};
105 {%- else %} 99 {%- else %}
106 MOJO_STATIC_CONST_MEMBER_DEFINITION const {{constant.kind|cpp_pod_type}} {{struc t.name}}::{{constant.name}} = {{constant|constant_value}}; 100 MOJO_STATIC_CONST_MEMBER_DEFINITION const {{constant.kind|cpp_pod_type}} {{struc t.name}}::{{constant.name}} = {{constant|constant_value}};
107 {%- endif %} 101 {%- endif %}
108 {%- endfor %} 102 {%- endfor %}
109 {%- endfor %} 103 {%- endfor %}
(...skipping 28 matching lines...) Expand all
138 {%- endif %} 132 {%- endif %}
139 {%- for namespace in namespaces_as_array|reverse %} 133 {%- for namespace in namespaces_as_array|reverse %}
140 } // namespace {{namespace}} 134 } // namespace {{namespace}}
141 {%- endfor %} 135 {%- endfor %}
142 136
143 #if defined(__clang__) 137 #if defined(__clang__)
144 #pragma clang diagnostic pop 138 #pragma clang diagnostic pop
145 #elif defined(_MSC_VER) 139 #elif defined(_MSC_VER)
146 #pragma warning(pop) 140 #pragma warning(pop)
147 #endif 141 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698