Index: mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl |
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl |
index 90c54f0ce06a508d86480e662271a38aac93ccb0..0b58d24fe54bb4a70b1cdb81f63d9f19f929309b 100644 |
--- a/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl |
+++ b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl |
@@ -12,11 +12,6 @@ |
variant_path|upper|replace("/","_")|replace(".","_")| |
replace("-", "_")) %} |
-{%- from "enum_macros.tmpl" import enum_decl %} |
-{%- from "enum_macros.tmpl" import enum_stream_operator %} |
-{%- from "enum_macros.tmpl" import is_known_enum_value %} |
-{%- from "enum_macros.tmpl" import enum_hash %} |
- |
{%- macro namespace_begin() %} |
{%- for namespace in namespaces_as_array %} |
namespace {{namespace}} { |
@@ -51,8 +46,6 @@ struct DataViewTraits<{{kind|get_qualified_name_for_kind}}DataView> { |
#include <stdint.h> |
-#include <functional> |
-#include <ostream> |
#include <type_traits> |
#include <utility> |
@@ -67,10 +60,10 @@ struct DataViewTraits<{{kind|get_qualified_name_for_kind}}DataView> { |
#include "mojo/public/cpp/bindings/lib/control_message_handler.h" |
#include "mojo/public/cpp/bindings/lib/control_message_proxy.h" |
#include "mojo/public/cpp/bindings/lib/serialization.h" |
+#include "mojo/public/cpp/bindings/lib/union_accessor.h" |
#include "mojo/public/cpp/bindings/map.h" |
#include "mojo/public/cpp/bindings/map_data_view.h" |
#include "mojo/public/cpp/bindings/message_filter.h" |
-#include "mojo/public/cpp/bindings/native_enum.h" |
#include "mojo/public/cpp/bindings/native_struct.h" |
#include "mojo/public/cpp/bindings/native_struct_data_view.h" |
#include "mojo/public/cpp/bindings/no_interface.h" |
@@ -78,7 +71,7 @@ struct DataViewTraits<{{kind|get_qualified_name_for_kind}}DataView> { |
#include "mojo/public/cpp/bindings/struct_ptr.h" |
#include "mojo/public/cpp/bindings/struct_traits.h" |
#include "mojo/public/cpp/bindings/union_traits.h" |
-#include "{{variant_path}}-internal.h" |
+#include "{{module.path}}-shared.h" |
{%- for import in imports %} |
{%- if variant %} |
#include "{{"%s-%s.h"|format(import.module.path, variant)}}" |
@@ -104,32 +97,15 @@ struct DataViewTraits<{{kind|get_qualified_name_for_kind}}DataView> { |
#include "{{export_header}}" |
{%- endif %} |
-{#--- Enums #} |
-{%- if enums %} |
{{namespace_begin()}} |
-{%- for enum in enums %} |
-{%- if enum|is_native_only_kind %} |
-using {{enum.name}} = mojo::NativeEnum; |
-{%- else %} |
-{{enum_decl(enum)}} |
-{{enum_stream_operator(enum)}} |
-{{is_known_enum_value(enum)}} |
-{%- endif %} |
-{%- endfor %} |
-{{namespace_end()}} |
- |
-namespace std { |
+{#--- Enums #} |
+{%- if variant %} |
{%- for enum in enums %} |
-{%- if not enum|is_native_only_kind %} |
-{{enum_hash(enum)}} |
-{%- endif %} |
+using {{enum.name}} = {{enum.name}}; // Alias for definition in the parent namespace. |
{%- endfor %} |
- |
-} // namespace std |
{%- endif %} |
-{{namespace_begin()}} |
{#--- Constants #} |
{%- for constant in module.constants %} |
@@ -187,27 +163,6 @@ typedef mojo::StructPtr<{{union.name}}> {{union.name}}Ptr; |
{#--- Interfaces -#} |
{% for interface in interfaces %} |
{% include "interface_declaration.tmpl" %} |
- |
-{%- if interface.enums %} |
-{{namespace_end()}} |
-namespace std { |
- |
-{%- for enum in interface.enums %} |
-{%- if not enum|is_native_only_kind %} |
-{{enum_hash(enum)}} |
-{%- endif %} |
-{%- endfor %} |
- |
-} // namespace std |
-{{namespace_begin()}} |
-{%- endif %} |
- |
-{%- for enum in interface.enums %} |
-{%- if not enum|is_native_only_kind %} |
-{{enum_stream_operator(enum)}} |
-{{is_known_enum_value(enum)}} |
-{%- endif %} |
-{%- endfor %} |
{%- endfor %} |
{#--- Interface Proxies -#} |
@@ -282,56 +237,12 @@ namespace std { |
{% include "wrapper_class_template_definition.tmpl" %} |
{% include "struct_data_view_definition.tmpl" %} |
{%- endif %} |
- |
-{%- if struct.enums %} |
-{{namespace_end()}} |
-namespace std { |
- |
-{%- for enum in struct.enums %} |
-{%- if not enum|is_native_only_kind %} |
-{{enum_hash(enum)}} |
-{%- endif %} |
-{%- endfor %} |
- |
-} // namespace std |
-{{namespace_begin()}} |
-{%- endif %} |
- |
-{%- for enum in struct.enums %} |
-{%- if not enum|is_native_only_kind %} |
-{{enum_stream_operator(enum)}} |
-{{is_known_enum_value(enum)}} |
-{%- endif %} |
-{%- endfor %} |
{%- endfor %} |
{{namespace_end()}} |
namespace mojo { |
-{#--- Enum Serialization Helpers -#} |
-{%- for enum in enums %} |
-{%- if not enum|is_native_only_kind %} |
-{% include "enum_serialization_declaration.tmpl" %} |
-{%- endif %} |
-{%- endfor %} |
- |
-{%- for struct in structs %} |
-{%- for enum in struct.enums %} |
-{%- if not enum|is_native_only_kind %} |
-{% include "enum_serialization_declaration.tmpl" %} |
-{%- endif %} |
-{%- endfor %} |
-{%- endfor %} |
- |
-{%- for interface in interfaces %} |
-{%- for enum in interface.enums %} |
-{%- if not enum|is_native_only_kind %} |
-{% include "enum_serialization_declaration.tmpl" %} |
-{%- endif %} |
-{%- endfor %} |
-{%- endfor %} |
- |
{#--- Struct Serialization Helpers -#} |
{% for struct in structs %} |
{%- if not struct|is_native_only_kind %} |