| {{/* |
| // Copyright 2021 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| */}} |
| |
| {{- define "Filename:Header" -}} |
| {{- /* TODO(fxbug.dev/74067): We should follow fxbug.dev/74067 and change |
| the header patterns from "Legacy" to "Unified". */}} |
| {{- .LibrarySlashes }}/cpp/fidl_v2.h |
| {{- end }} |
| |
| {{- define "File:Header" -}} |
| {{- UseUnified -}} |
| |
| // WARNING: This file is machine generated by fidlgen_cpp. |
| |
| #pragma once |
| |
| {{ "" }} |
| {{- /* Include library headers from dependencies. */}} |
| {{ range .Dependencies -}} |
| #include <{{ . | Filename "Header" }}> |
| {{ end -}} |
| |
| {{- /* When the library name only has one component, it is always special. |
| Those libraries should not define business logic types or protocols, and we |
| do not support them in the bindings. */}} |
| {{- if not .SingleComponentLibraryName }} |
| |
| #include <lib/fidl/cpp/internal/codable_base.h> |
| #include <lib/fidl/cpp/internal/message_extensions.h> |
| #include <lib/fidl/cpp/natural_types.h> |
| #include <lib/fidl/cpp/unified_messaging.h> |
| |
| #include <{{ .LegacyIncludeDir }}/natural_types.h> |
| #include <{{ .UnifiedIncludeDir }}/wire.h> |
| |
| {{ "" }} |
| |
| {{- /* Generate our own domain objects. */}} |
| {{- range .Decls }} |
| {{- if Eq .Kind Kinds.Struct }}{{- template "StructForwardDeclaration" . }}{{- end }} |
| {{- end }} |
| |
| {{- /* Bring the natural domain object types into our namespace. */}} |
| {{- range .Decls | SkipRequestResponseDecls }} |
| {{- if Eq .Kind Kinds.Bits }}{{ template "NaturalTypeAlias" . }}{{- end }} |
| {{- if Eq .Kind Kinds.Enum }}{{ template "NaturalTypeAlias" . }}{{- end }} |
| {{- if Eq .Kind Kinds.Table }}{{ template "NaturalTypeAlias" . }}{{- end }} |
| {{- if Eq .Kind Kinds.Union }}{{ template "NaturalTypeAlias" . }}{{- end }} |
| {{ "" }} |
| {{- end }} |
| |
| {{- /* Generate our own domain objects. */}} |
| {{- range .Decls }} |
| {{- if Eq .Kind Kinds.Struct }}{{ template "StructDeclaration" . }}{{- end }} |
| {{- if Eq .Kind Kinds.Const }}{{ template "ConstDeclaration" . }}{{- end }} |
| {{ "" }} |
| {{- end }} |
| |
| {{ EnsureNamespace "fidl" }} |
| {{- range .Decls }} |
| {{- if Eq .Kind Kinds.Struct }}{{ template "StructTraits" . }}{{- end }} |
| {{- end }} |
| {{ "" }} |
| |
| {{- end }}{{/* if not SingleComponentLibraryName */}} |
| |
| {{ EndOfFile }} |
| {{ end }} |
| |