blob: aafcd3c00c1997c038bcd8beecb8295b1a48d88a [file]
// Copyright 2016 The Chromium 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 templates
const GenerateSourceFile = `
{{- define "GenerateSourceFile" -}}
// This file was auto-generated by the C bindings generator.
#include "{{.HeaderFile}}"
#include <stdbool.h>
#include "mojo/public/c/bindings/mojom/buffer.h"
#include "mojo/public/c/bindings/mojom/array.h"
#include "mojo/public/c/bindings/mojom/map.h"
#include "mojo/public/c/bindings/mojom/string.h"
#include "mojo/public/c/bindings/mojom/table.h"
#include "mojo/public/c/bindings/mojom/types.h"
#include "mojo/public/c/system/handle.h"
// Imports.
{{range $import := .Imports -}}
#include "{{$import}}"
{{end}}
// Type tables definitions for structs, arrays and unions.
{{template "GenerateTypeTableDefinitions" .TypeTable}}
// Definitions for constants.
// Top level constants:
{{range $const := .Constants -}}
const {{$const.Type}} {{$const.Name}} = {{$const.Value}};
{{end -}}
// Struct level constants:
{{range $struct := .Structs -}}
{{range $const := $struct.Constants -}}
const {{$const.Type}} {{$const.Name}} = {{$const.Value}};
{{end -}}
{{end -}}
// Interface level constants:
{{range $interface := .Interfaces -}}
{{range $const := $interface.Constants -}}
const {{$const.Type}} {{$const.Name}} = {{$const.Value}};
{{end -}}
{{end -}}
{{end}}
`