-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdump_enum.go
More file actions
46 lines (36 loc) · 1.02 KB
/
dump_enum.go
File metadata and controls
46 lines (36 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package protoss
import "google.golang.org/protobuf/types/descriptorpb"
func (fd *filedumper) dump_enum_definition(enum_descriptor *descriptorpb.EnumDescriptorProto) (err error) {
fd.indent()
fd.printf("enum %s {\n", enum_descriptor.GetName())
fd.line_indentation++
if enum_descriptor.GetOptions() != nil {
any_options := false
options := enum_descriptor.GetOptions()
if options.AllowAlias != nil {
fd.indent()
fd.printf("option allow_alias = %t;\n", options.GetAllowAlias())
any_options = true
}
if options.Deprecated != nil {
fd.indent()
fd.printf("option deprecated = %t;\n", options.GetDeprecated())
any_options = true
}
if any_options {
fd.printf("\n")
}
}
for _, enum_value := range enum_descriptor.Value {
fd.indent()
fd.printf("%s = %d", enum_value.GetName(), enum_value.GetNumber())
// if enum_value.Options != nil {
// if enum_value.
// }
fd.printf(";\n")
}
fd.line_indentation--
fd.indent()
fd.printf("}\n")
return
}