blob: d20b8432a0271bdbfe21b11209b142ca80c4f000 [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:Implementation" -}}
{{- .LibrarySlashes }}/cpp/fidl.cc
{{- end }}
{{- define "File:Implementation" -}}
{{- UseHLCPP -}}
// WARNING: This file is machine generated by fidlgen.
{{- /* 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 <{{ .Library | Filename "Header" }}>
#include "lib/fidl/cpp/internal/implementation.h"
{{ template "Implementation/DomainObjects" . }}
{{ template "Implementation/ProxiesAndStubs" . }}
{{- end }}{{/* if not SingleComponentLibraryName */}}
{{ EndOfFile }}
{{ end }}
{{- define "Implementation/DomainObjects" }}
//
// Domain objects definitions
//
{{- range .Decls }}
{{- if Eq .Kind Kinds.Bits }}{{ template "BitsDefinition" . }}{{- end }}
{{- if Eq .Kind Kinds.Const }}{{ template "ConstDefinition" . }}{{- end }}
{{- if Eq .Kind Kinds.Enum }}{{ template "EnumDefinition" . }}{{- end }}
{{- if Eq .Kind Kinds.Struct }}{{ template "StructDefinition" . }}{{- end }}
{{- if Eq .Kind Kinds.Union }}{{ template "UnionDefinition" . }}{{- end }}
{{- if Eq .Kind Kinds.Table }}{{ template "TableDefinition" . }}{{- end }}
{{- end }}
{{- end }}
{{- define "Implementation/ProxiesAndStubs" }}
//
// Proxies and stubs definitions
//
{{- range .Decls }}
{{- if Eq .Kind Kinds.Protocol }}
{{- template "DispatchProtocolDefinition" .WithHlMessaging }}
{{- end }}
{{- end }}
{{- end }}
{{- define "DispatchProtocolDefinition" -}}
{{- range $transport, $_ := .Transports }}
{{- if eq $transport "Channel" }}
{{- template "ProtocolDefinition" $.WithHlMessaging }}
{{- end }}
{{- end }}
{{- end -}}