Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Asn1Enumeration.cs
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Threading.Tasks;
5
7{
12 {
19 public Asn1Enumeration(string Name, bool TypeDef, Asn1Node[] Nodes)
20 : base(Name, TypeDef, Nodes)
21 {
22 }
23
27 public override bool ConstructedType => true;
28
36 public override async Task ExportCSharp(StringBuilder Output, CSharpExportState State,
37 int Indent, CSharpExportPass Pass)
38 {
39 if (Pass == CSharpExportPass.Explicit)
40 {
41 Output.Append(ToCSharp(this.Name));
42
43 if (!this.TypeDefinition)
44 Output.Append("Enum");
45
46 if (this.Optional.HasValue && this.Optional.Value)
47 Output.Append('?');
48 }
49 else if (Pass == CSharpExportPass.Implicit)
50 {
51 Output.Append(Tabs(Indent));
52 Output.Append("public enum ");
53 Output.Append(ToCSharp(this.Name));
54 if (!this.TypeDefinition)
55 Output.AppendLine("Enum");
56
57 Output.Append(Tabs(Indent));
58 Output.Append("{");
59
60 Indent++;
61
62 bool First = true;
63
64 foreach (Asn1Node Node in this.Nodes)
65 {
66 if (First)
67 First = false;
68 else
69 Output.Append(',');
70
71 Output.AppendLine();
72 Output.Append(Tabs(Indent));
73 await Node.ExportCSharp(Output, State, Indent, CSharpExportPass.Explicit);
74 }
75
76 Indent--;
77
78 Output.AppendLine();
79 Output.Append(Tabs(Indent));
80 Output.AppendLine("}");
81 Output.AppendLine();
82 }
83 }
84
85 }
86}
string Name
Optional field or type name.
bool TypeDefinition
If construct is part of a type definition.
override bool ConstructedType
If the type is a constructed type.
Asn1Enumeration(string Name, bool TypeDef, Asn1Node[] Nodes)
ENUMERATED
override async Task ExportCSharp(StringBuilder Output, CSharpExportState State, int Indent, CSharpExportPass Pass)
Exports to C#
Abstract base class for list constructs.
Definition: Asn1List.cs:11
Base class for all ASN.1 nodes.
Definition: Asn1Node.cs:38
virtual Task ExportCSharp(StringBuilder Output, CSharpExportState State, int Indent, CSharpExportPass Pass)
Exports to C#
Definition: Asn1Node.cs:46
bool? Optional
If the type is optional
Definition: Asn1Type.cs:52
CSharpExportPass
Defines different C# export passes.
Definition: Asn1Node.cs:12