blob: 7ec5303fa3a38e7b52533a721393579fbf0c202a [file]
// 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.
package codegen
const fileSourceTmpl = `
{{- define "Source" -}}
{{- UseWire -}}
// WARNING: This file is machine generated by fidlgen.
#include <{{ .PrimaryHeader }}>
#include <memory>
{{ "" }}
{{- range .Decls }}
{{- if Eq .Kind Kinds.Const }}{{ template "ConstDefinition" . }}{{- end }}
{{- if Eq .Kind Kinds.Protocol }}{{ $protocol := . }}
{{- range $transport, $_ := .Transports }}{{- if eq $transport "Channel" -}}
{{ template "ProtocolDefinition" $protocol }}
{{ template "EventSenderDefinition" $protocol }}
{{- end }}{{ end }}{{ 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 }}
{{ "" }}
{{ EndOfFile }}
{{ end }}
`