blob: 6e5bcf85fc296250381e8ae5851674cd5f2c3dfc [file] [log] [blame]
{{/*
// Copyright 2018 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" -}}
{{- .LibrarySlashes }}/cpp/fidl.h
{{- end }}
{{- define "File:Header" -}}
{{- UseHLCPP -}}
// WARNING: This file is machine generated by fidlgen.
#pragma once
#include "lib/fidl/cpp/internal/header.h"
{{ range .Dependencies -}}
#include <{{ . | Filename "Header" }}>
{{ end -}}
{{ EnsureNamespace . }}
{{ template "Header/DomainObjects" . }}
{{ template "Header/ProxiesAndStubs" . }}
{{ EndOfFile }}
{{ end }}
{{- define "Header/DomainObjects" }}
//
// Domain objects declarations
//
{{- range .Decls }}
{{- if Eq .Kind Kinds.Bits }}{{ template "BitsForwardDeclaration" . }}{{- end }}
{{- if Eq .Kind Kinds.Enum }}{{ template "EnumForwardDeclaration" . }}{{- end }}
{{- if Eq .Kind Kinds.Protocol }}{{ template "DispatchProtocolForwardDeclaration/DomainObjects" . }}{{- end }}
{{- if Eq .Kind Kinds.Service }}{{ template "DispatchServiceForwardDeclaration" . }}{{- end }}
{{- if Eq .Kind Kinds.Struct }}{{- template "StructForwardDeclaration" . }}{{- end }}
{{- if Eq .Kind Kinds.Table }}{{ template "TableForwardDeclaration" . }}{{- end }}
{{- if Eq .Kind Kinds.Union }}{{ template "UnionForwardDeclaration" . }}{{- end }}
{{- end }}
{{- range .Decls }}
{{- if Eq .Kind Kinds.Const }}{{ template "ConstDeclaration" . }}{{- end }}
{{- if Eq .Kind Kinds.Protocol }}{{ template "DispatchProtocolDeclaration/DomainObjects" . }}{{- end }}
{{- if Eq .Kind Kinds.Struct }}{{ template "StructDeclaration" . }}{{- end }}
{{- if Eq .Kind Kinds.Table }}{{ template "TableDeclaration" . }}{{- end }}
{{- if Eq .Kind Kinds.Union }}{{ template "UnionDeclaration" . }}{{- end }}
{{- end }}
{{ EnsureNamespace "fidl" }}
{{- range .Decls }}
{{- if Eq .Kind Kinds.Bits }}{{ template "BitsTraits" . }}{{- end }}
{{- if Eq .Kind Kinds.Enum }}{{ template "EnumTraits" . }}{{- end }}
{{- if Eq .Kind Kinds.Struct }}{{ template "StructTraits" . }}{{- end }}
{{- if Eq .Kind Kinds.Table }}{{ template "TableTraits" . }}{{- end }}
{{- if Eq .Kind Kinds.Union }}{{ template "UnionTraits" . }}{{- end }}
{{- end -}}
{{- end }}
{{- define "Header/ProxiesAndStubs" }}
//
// Proxies and stubs declarations
//
{{- range .Decls }}
{{- if Eq .Kind Kinds.Protocol }}
{{- template "DispatchProtocolForwardDeclaration/ProxiesAndStubs" .WithHlMessaging }}
{{- end }}
{{- if Eq .Kind Kinds.Service }}
{{- template "DispatchServiceForwardDeclaration" . }}
{{- end }}
{{- end }}
{{- range .Decls }}
{{- if Eq .Kind Kinds.Protocol }}
{{- template "DispatchProtocolDeclaration/ProxiesAndStubs" .WithHlMessaging }}
{{- end }}
{{- if Eq .Kind Kinds.Service }}
{{- template "DispatchServiceDeclaration" . }}
{{- end }}
{{- end }}
{{- end }}
{{- define "DispatchProtocolForwardDeclaration/DomainObjects" -}}
{{- range $transport, $_ := .Transports }}
{{- if eq $transport "Channel" }}
{{- template "ProtocolForwardDeclaration/DomainObjects" $.WithHlMessaging }}
{{- end }}
{{- end }}
{{- end }}
{{- define "DispatchProtocolDeclaration/DomainObjects" -}}
{{- range $transport, $_ := .Transports }}
{{- if eq $transport "Channel" }}
{{- template "ProtocolDeclaration/DomainObjects" $.WithHlMessaging }}
{{- end }}
{{- end }}
{{- end }}
{{- define "DispatchProtocolForwardDeclaration/ProxiesAndStubs" -}}
{{- range $transport, $_ := .Transports }}
{{- if eq $transport "Channel" }}
{{- template "ProtocolForwardDeclaration/ProxiesAndStubs" $.WithHlMessaging }}
{{- end }}
{{- end }}
{{- end }}
{{- define "DispatchProtocolDeclaration/ProxiesAndStubs" -}}
{{- range $transport, $_ := .Transports }}
{{- if eq $transport "Channel" }}
{{- template "ProtocolDeclaration/ProxiesAndStubs" $.WithHlMessaging }}
{{- end }}
{{- end }}
{{- end }}
{{- define "DispatchServiceForwardDeclaration" -}}
{{- range $transport, $_ := .Transports }}
{{- if eq $transport "Channel" -}}{{ template "ServiceForwardDeclaration" $ }}{{- end }}
{{- end }}
{{- end }}
{{- define "DispatchServiceDeclaration" -}}
{{- range $transport, $_ := .Transports }}
{{- if eq $transport "Channel" -}}{{ template "ServiceDeclaration" $ }}{{- end }}
{{- end }}
{{- end }}