| OLD | NEW |
| (Empty) |
| 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 variant -%} | |
| 6 {%- set variant_path = "%s-%s"|format(module.path, variant) -%} | |
| 7 {%- else -%} | |
| 8 {%- set variant_path = module.path -%} | |
| 9 {%- endif -%} | |
| 10 | |
| 11 {%- set header_guard = "%s_INTERNAL_H_"|format( | |
| 12 variant_path|upper|replace("/","_")|replace(".","_")| | |
| 13 replace("-", "_")) %} | |
| 14 | |
| 15 #ifndef {{header_guard}} | |
| 16 #define {{header_guard}} | |
| 17 | |
| 18 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" | |
| 19 #include "mojo/public/cpp/bindings/lib/buffer.h" | |
| 20 #include "mojo/public/cpp/bindings/lib/serialization.h" | |
| 21 #include "mojo/public/cpp/bindings/lib/union_accessor.h" | |
| 22 #include "mojo/public/cpp/bindings/struct_ptr.h" | |
| 23 | |
| 24 {%- for import in imports %} | |
| 25 {%- if variant %} | |
| 26 #include "{{"%s-%s-internal.h"|format(import.module.path, variant)}}" | |
| 27 {%- else %} | |
| 28 #include "{{import.module.path}}-internal.h" | |
| 29 {%- endif %} | |
| 30 {%- endfor %} | |
| 31 | |
| 32 {%- if export_header %} | |
| 33 #include "{{export_header}}" | |
| 34 {%- endif %} | |
| 35 | |
| 36 namespace mojo { | |
| 37 namespace internal { | |
| 38 class ValidationContext; | |
| 39 } | |
| 40 } | |
| 41 | |
| 42 {%- for namespace in namespaces_as_array %} | |
| 43 namespace {{namespace}} { | |
| 44 {%- endfor %} | |
| 45 {%- if variant %} | |
| 46 namespace {{variant}} { | |
| 47 {%- endif %} | |
| 48 | |
| 49 {#--- Wrapper forward declarations #} | |
| 50 {% for struct in structs %} | |
| 51 {%- if struct|is_native_only_kind %} | |
| 52 using {{struct.name}} = mojo::NativeStruct; | |
| 53 {%- else %} | |
| 54 class {{struct.name}}; | |
| 55 {%- endif %} | |
| 56 {%- endfor %} | |
| 57 | |
| 58 {#--- Wrapper forward declarations for unions #} | |
| 59 {% for union in unions %} | |
| 60 class {{union.name}}; | |
| 61 {%- endfor %} | |
| 62 | |
| 63 namespace internal { | |
| 64 | |
| 65 {#--- Internal forward declarations #} | |
| 66 {% for struct in structs %} | |
| 67 {%- if struct|is_native_only_kind %} | |
| 68 using {{struct.name}}_Data = mojo::internal::NativeStruct_Data; | |
| 69 {%- else %} | |
| 70 class {{struct.name}}_Data; | |
| 71 {%- endif %} | |
| 72 {%- endfor %} | |
| 73 | |
| 74 {% for union in unions %} | |
| 75 class {{union.name}}_Data; | |
| 76 {%- endfor %} | |
| 77 | |
| 78 {#--- Enums #} | |
| 79 {% from "enum_macros.tmpl" import enum_data_decl -%} | |
| 80 {%- for enum in enums %} | |
| 81 {%- if enum|is_native_only_kind %} | |
| 82 using {{enum.name}}_Data = mojo::internal::NativeEnum_Data; | |
| 83 {%- else %} | |
| 84 {{enum_data_decl(enum)}} | |
| 85 {%- endif %} | |
| 86 {%- endfor %} | |
| 87 | |
| 88 #pragma pack(push, 1) | |
| 89 | |
| 90 {#--- Unions must be declared first because they can be members of structs #} | |
| 91 {#--- Union class declarations #} | |
| 92 {% for union in unions %} | |
| 93 {% include "union_declaration.tmpl" %} | |
| 94 {%- endfor %} | |
| 95 | |
| 96 {#--- Struct class declarations #} | |
| 97 {% for struct in structs %} | |
| 98 {%- if not struct|is_native_only_kind %} | |
| 99 {% include "struct_declaration.tmpl" %} | |
| 100 {%- endif %} | |
| 101 {%- endfor %} | |
| 102 | |
| 103 {#--- Interface class declarations. They are needed only when they contain | |
| 104 enums. #} | |
| 105 {%- for interface in interfaces %} | |
| 106 {%- if interface.enums %} | |
| 107 class {{interface.name}}_Data { | |
| 108 public: | |
| 109 {%- for enum in interface.enums %} | |
| 110 {%- if enum|is_native_only_kind %} | |
| 111 using {{enum.name}}_Data = mojo::internal::NativeEnum_Data; | |
| 112 {%- else %} | |
| 113 {{enum_data_decl(enum)|indent(2)}} | |
| 114 {%- endif %} | |
| 115 {%- endfor %} | |
| 116 }; | |
| 117 {%- endif %} | |
| 118 {%- endfor %} | |
| 119 | |
| 120 #pragma pack(pop) | |
| 121 | |
| 122 } // namespace internal | |
| 123 {%- if variant %} | |
| 124 } // namespace {{variant}} | |
| 125 {%- endif %} | |
| 126 {%- for namespace in namespaces_as_array|reverse %} | |
| 127 } // namespace {{namespace}} | |
| 128 {%- endfor %} | |
| 129 | |
| 130 #endif // {{header_guard}} | |
| OLD | NEW |