blob: 8c55ddd25d095dc0c351a98048adbc0e3e39ecc0 [file] [log] [blame] [edit]
{{/*
// 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/
{{- if ExperimentEnabled "natural-types" -}}
natural_types.cc
{{- else -}}
fidl.cc
{{- end -}}
{{- end }}
{{- define "File:Implementation" -}}
{{- UseNatural -}}
// WARNING: This file is machine generated by fidlgen.
#include <{{ .Library | Filename "Header" }}>
{{ if ExperimentEnabled "natural-types" -}}
#include "lib/fidl/cpp/internal/natural_types_implementation.h"
{{ else -}}
#include "lib/fidl/cpp/internal/implementation.h"
{{- end }}
{{ template "Implementation/NaturalTypes" . }}
{{ if not (ExperimentEnabled "natural-types") -}}
{{ template "Implementation/ProxiesAndStubs" . }}
{{- end }}
{{ EndOfFile }}
{{ end }}
{{- define "Implementation/NaturalTypes" }}
//
// Domain objects definitions (i.e. "natural types" in unified bindings)
//
{{- 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 -}}