blob: 349d8f92b862d6e8cb8368b3b76ba3cd95461d03 [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 "BitsDeclaration" -}}
{{ .PythonName }} = enum.IntFlag("{{ .PythonName }}", {
{{- if .DocComments }}
"__doc__": """
{{- range .DocComments }}
{{ . | escapeQuotes | trimSpace | indentNonEmpty8 }}
{{- end }}
""",
{{- end }}
"__fidl_kind__": "bits",
"__fidl_type__": "{{ .PythonName }}",
"__fidl_raw_type__": "{{ .Name }}",
"__strict__": {{ if .Strictness }}True{{ else }}False{{ end }},
{{ range .PythonMembers -}}
"{{ .PythonName }}": {{ .PythonValue }},
{{ end }}
{{- if .Empty -}}
"EMPTY__": 0,
{{ end -}}
"make_default": classmethod(lambda cls: cls(value=0)),
})
{{ end }}