| Index: mojo/public/tools/bindings/generators/cpp_templates/module-shared-internal.h.tmpl
|
| diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module-shared-internal.h.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module-shared-internal.h.tmpl
|
| index 70b6a9a718d9b6e7b9d4d9577377a5115fd19794..bb5acd934333c149e94912d258c0630b5ded7bbd 100644
|
| --- a/mojo/public/tools/bindings/generators/cpp_templates/module-shared-internal.h.tmpl
|
| +++ b/mojo/public/tools/bindings/generators/cpp_templates/module-shared-internal.h.tmpl
|
| @@ -2,4 +2,94 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -// TODO(yzshen): Move code here.
|
| +{%- set header_guard = "%s_SHARED_INTERNAL_H_"|format(
|
| + module.path|upper|replace("/","_")|replace(".","_")|
|
| + replace("-", "_")) %}
|
| +
|
| +#ifndef {{header_guard}}
|
| +#define {{header_guard}}
|
| +
|
| +#include <stdint.h>
|
| +
|
| +#include "mojo/public/cpp/bindings/lib/array_internal.h"
|
| +#include "mojo/public/cpp/bindings/lib/bindings_internal.h"
|
| +#include "mojo/public/cpp/bindings/lib/map_data_internal.h"
|
| +#include "mojo/public/cpp/bindings/lib/native_enum_data.h"
|
| +#include "mojo/public/cpp/bindings/lib/native_struct_data.h"
|
| +#include "mojo/public/cpp/bindings/lib/buffer.h"
|
| +
|
| +{%- for import in imports %}
|
| +#include "{{import.module.path}}-shared-internal.h"
|
| +{%- endfor %}
|
| +
|
| +namespace mojo {
|
| +namespace internal {
|
| +class ValidationContext;
|
| +}
|
| +}
|
| +
|
| +{%- for namespace in namespaces_as_array %}
|
| +namespace {{namespace}} {
|
| +{%- endfor %}
|
| +namespace internal {
|
| +
|
| +{#--- Internal forward declarations #}
|
| +{%- for struct in structs %}
|
| +{%- if struct|is_native_only_kind %}
|
| +using {{struct.name}}_Data = mojo::internal::NativeStruct_Data;
|
| +{%- else %}
|
| +class {{struct.name}}_Data;
|
| +{%- endif %}
|
| +{%- endfor %}
|
| +
|
| +{%- for union in unions %}
|
| +class {{union.name}}_Data;
|
| +{%- endfor %}
|
| +
|
| +{#--- Enums #}
|
| +{%- from "enum_macros.tmpl" import enum_data_decl -%}
|
| +{%- for enum in all_enums %}
|
| +{%- if enum|is_native_only_kind %}
|
| +using {{enum.name}}_Data = mojo::internal::NativeEnum_Data;
|
| +{%- else %}
|
| +{{enum_data_decl(enum)}}
|
| +{%- endif %}
|
| +{%- endfor %}
|
| +
|
| +#pragma pack(push, 1)
|
| +
|
| +{#--- Unions must be declared first because they can be members of structs #}
|
| +{#--- Union class declarations #}
|
| +{%- for union in unions %}
|
| +{% include "union_declaration.tmpl" %}
|
| +{%- endfor %}
|
| +
|
| +{#--- Struct class declarations #}
|
| +{%- for struct in structs %}
|
| +{%- if not struct|is_native_only_kind %}
|
| +{% include "struct_declaration.tmpl" %}
|
| +{%- endif %}
|
| +{%- endfor %}
|
| +
|
| +{#--- Interface parameter definitions #}
|
| +{%- for interface in interfaces %}
|
| +{%- for method in interface.methods %}
|
| +{%- set method_name = "k%s_%s_Name"|format(interface.name, method.name) %}
|
| +const uint32_t {{method_name}} = {{method.ordinal}};
|
| +{%- set struct = method.param_struct %}
|
| +{% include "struct_declaration.tmpl" %}
|
| +{%- if method.response_parameters != None %}
|
| +{%- set struct = method.response_param_struct %}
|
| +{% include "struct_declaration.tmpl" %}
|
| +{%- endif %}
|
| +{%- endfor %}
|
| +{%- endfor %}
|
| +
|
| +#pragma pack(pop)
|
| +
|
| +} // namespace internal
|
| +{%- for namespace in namespaces_as_array|reverse %}
|
| +} // namespace {{namespace}}
|
| +{%- endfor %}
|
| +
|
| +#endif // {{header_guard}}
|
|
|