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

Unified Diff: mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl

Issue 2247083003: Mojo C++ bindings: extract code shared by different variants. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl
deleted file mode 100644
index aed7ac042f9794657b152e095bc4f9d2ff7f694a..0000000000000000000000000000000000000000
--- a/mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-{%- if variant -%}
-{%- set variant_path = "%s-%s"|format(module.path, variant) -%}
-{%- else -%}
-{%- set variant_path = module.path -%}
-{%- endif -%}
-
-{%- set header_guard = "%s_INTERNAL_H_"|format(
- variant_path|upper|replace("/","_")|replace(".","_")|
- replace("-", "_")) %}
-
-#ifndef {{header_guard}}
-#define {{header_guard}}
-
-#include "mojo/public/cpp/bindings/lib/bindings_internal.h"
-#include "mojo/public/cpp/bindings/lib/buffer.h"
-#include "mojo/public/cpp/bindings/lib/serialization.h"
-#include "mojo/public/cpp/bindings/lib/union_accessor.h"
-#include "mojo/public/cpp/bindings/struct_ptr.h"
-
-{%- for import in imports %}
-{%- if variant %}
-#include "{{"%s-%s-internal.h"|format(import.module.path, variant)}}"
-{%- else %}
-#include "{{import.module.path}}-internal.h"
-{%- endif %}
-{%- endfor %}
-
-{%- if export_header %}
-#include "{{export_header}}"
-{%- endif %}
-
-namespace mojo {
-namespace internal {
-class ValidationContext;
-}
-}
-
-{%- for namespace in namespaces_as_array %}
-namespace {{namespace}} {
-{%- endfor %}
-{%- if variant %}
-namespace {{variant}} {
-{%- endif %}
-
-{#--- Wrapper forward declarations #}
-{% for struct in structs %}
-{%- if struct|is_native_only_kind %}
-using {{struct.name}} = mojo::NativeStruct;
-{%- else %}
-class {{struct.name}};
-{%- endif %}
-{%- endfor %}
-
-{#--- Wrapper forward declarations for unions #}
-{% for union in unions %}
-class {{union.name}};
-{%- 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 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 class declarations. They are needed only when they contain
- enums. #}
-{%- for interface in interfaces %}
-{%- if interface.enums %}
-class {{interface.name}}_Data {
- public:
-{%- for enum in interface.enums %}
-{%- if enum|is_native_only_kind %}
- using {{enum.name}}_Data = mojo::internal::NativeEnum_Data;
-{%- else %}
- {{enum_data_decl(enum)|indent(2)}}
-{%- endif %}
-{%- endfor %}
-};
-{%- endif %}
-{%- endfor %}
-
-#pragma pack(pop)
-
-} // namespace internal
-{%- if variant %}
-} // namespace {{variant}}
-{%- endif %}
-{%- for namespace in namespaces_as_array|reverse %}
-} // namespace {{namespace}}
-{%- endfor %}
-
-#endif // {{header_guard}}

Powered by Google App Engine
This is Rietveld 408576698