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 3// found in the LICENSE file. 4 5#if defined(__clang__) 6#pragma clang diagnostic push 7#pragma clang diagnostic ignored "-Wunused-private-field" 8#endif 9 10#include "{{module.path}}.h" 11 12#include "mojo/public/cpp/bindings/lib/array_serialization.h" 13#include "mojo/public/cpp/bindings/lib/bindings_serialization.h" 14#include "mojo/public/cpp/bindings/lib/bounds_checker.h" 15#include "mojo/public/cpp/bindings/lib/message_builder.h" 16#include "mojo/public/cpp/bindings/lib/string_serialization.h" 17#include "mojo/public/cpp/bindings/lib/validation_errors.h" 18 19{%- for namespace in namespaces_as_array %} 20namespace {{namespace}} { 21{%- endfor %} 22 23{#--- Constants #} 24{% for constant in module.constants %} 25const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant.value|expression_to_text}}; 26{%- endfor %} 27 28namespace internal { 29namespace { 30 31#pragma pack(push, 1) 32 33{#--- Interface parameter definitions #} 34{%- for interface in interfaces %} 35{%- for method in interface.methods %} 36{%- set method_name = "k%s_%s_Name"|format(interface.name, method.name) %} 37const uint32_t {{method_name}} = {{method.ordinal}}; 38{% set struct = method|struct_from_method %} 39{%- include "params_definition.tmpl" %} 40{%- if method.response_parameters != None %} 41{%- set struct = method|response_struct_from_method %} 42{%- include "params_definition.tmpl" %} 43{%- endif %} 44{%- endfor %} 45{%- endfor %} 46 47#pragma pack(pop) 48 49} // namespace 50 51{#--- Struct definitions #} 52{% for struct in structs %} 53{%- include "struct_definition.tmpl" %} 54{%- endfor %} 55 56} // namespace internal 57 58{#--- Struct Constants #} 59{%- for struct in structs %} 60{% for constant in struct.constants %} 61const {{constant.kind|cpp_pod_type}} {{struct.name}}::{{constant.name}} = {{constant.value|expression_to_text}}; 62{%- endfor %} 63{%- endfor %} 64 65{#--- Struct builder definitions #} 66{%- for struct in structs %} 67{%- include "wrapper_class_definition.tmpl" %} 68{%- endfor %} 69 70{#--- Interface definitions #} 71{%- for interface in interfaces %} 72{%- include "interface_definition.tmpl" %} 73{%- endfor %} 74 75{#--- Struct Serialization Helpers #} 76{%- for struct in structs %} 77{%- include "struct_serialization_definition.tmpl" %} 78{%- endfor %} 79 80{%- for namespace in namespaces_as_array|reverse %} 81} // namespace {{namespace}} 82{%- endfor %} 83 84#if defined(__clang__) 85#pragma clang diagnostic pop 86#endif 87