123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- -- this file is auto create by program, don't edit manually
- -- template document https://pkg.go.dev/text/template@go1.17.2
- -- enums
- {{- range .CustomEnums}}
- {{.Name}} = {
- {{- $maxNameLen := (CustomEnumNameMaxLen .)}}
- {{- $nameFmt := (printf "%%-%ds" $maxNameLen)}}
- {{- $maxValueLen := (CustomEnumValueMaxLen .)}}
- {{- $maxValueLen = (Add $maxValueLen 1)}}
- {{- $valueFmt := (printf "%%-%ds" $maxValueLen)}}
- {{- $m := (len .Values)}}{{$m = (Add $m -1)}}
- {{- range $index, $element := .Values}}
- {{ .Name | printf $nameFmt}} =
- {{- if lt $index $m}} {{printf "%d," .Value | printf $valueFmt}}
- {{- else}} {{printf "%d " .Value | printf $valueFmt}}{{end}} -- {{.Comment}}
- {{- end}}
- }
- {{end}}
- -- custom types
- ConfigType = {}
- {{- range .CustomTypes}}
- function ConfigType.{{.Name}}(
- {{- range $index, $element := .Fields}}{{if ge $index 1}},{{end}}{{.Name}}{{end}})
- local o = {
- {{- $maxNameLen := (CustomTypeNameMaxLen .)}}
- {{- $nameFmt := (printf "%%-%ds" $maxNameLen)}}
- {{- $maxNameLen = (Add $maxNameLen 1)}}
- {{- $nameFmt2 := (printf "%%-%ds" $maxNameLen)}}
- {{- $m := (len .Fields)}}{{$m = (Add $m -1)}}
- {{- range $index, $element := .Fields}}
- {{.Name | printf $nameFmt}} =
- {{- if lt $index $m}} {{printf "%s," .Name | printf $nameFmt2}}
- {{- else}} {{printf "%s " .Name | printf $nameFmt2}}{{end}}--{{.Comment}}
- {{- end}}
- }
- return o
- end
- {{end}}
|