blob: 5d2fbb55fcdc57667867a9bf1dd41c42a0419d7c [file] [log] [blame] [edit]
{{/*
// Copyright 2025 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.
*/}}
{{/*
// TODO(https://fxbug.dev/394421154): This should really be a class that inherits from enum.IntFlag,
// but doing so requires creating a new GIDL backend because the fuchsia-controller backend
// generates tests that use ints for the value of bits types.
*/}}
{{ define "EnumDeclaration" -}}
{{ .PythonName }} = enum.IntEnum("{{ .PythonName }}", {
{{- if .DocComments }}
"__doc__": """
{{- range .DocComments }}
{{ . | escapeQuotes | trimSpace | indentNonEmpty8 }}
{{- end -}}
""",
{{- end }}
"__fidl_kind__": "enum",
"__fidl_type__": "{{ .PythonName }}",
"__fidl_raw_type__": "{{ .Name }}",
"__strict__": {{ if .Strictness }}True{{ else }}False{{ end }},
{{ range .PythonMembers -}}
"{{ .PythonName }}": {{ .PythonValue }},
{{ end }}
{{- if or .Empty (not .HasZero) -}}
"EMPTY__": 0,
{{ end -}}
"make_default": classmethod(lambda cls: cls(0)),
})
{{ end }}