diff options
Diffstat (limited to 'dotnet/client-010/gentool/Enum.tpl')
-rw-r--r-- | dotnet/client-010/gentool/Enum.tpl | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/dotnet/client-010/gentool/Enum.tpl b/dotnet/client-010/gentool/Enum.tpl new file mode 100644 index 0000000000..33af038cc6 --- /dev/null +++ b/dotnet/client-010/gentool/Enum.tpl @@ -0,0 +1,38 @@ +using System; +namespace org.apache.qpid.transport +{ +${ +from genutil import * + +vtype = jtype(resolve_type(type)) + +out(" public enum $name : $vtype") + +choices = [(scream(ch["@name"]), "= %s" % (ch["@value"])) + for ch in type.query["enum/choice"]] +} + { + $(",\n ".join(["%s%s" % ch for ch in choices])) + } + +${ + +out(" public struct $name") +out("Getter") +} + { + public static $name Get($vtype value) + { + switch (value) + { +${ +choices = [(scream(ch["@name"]), "%s" % (ch["@value"])) + for ch in type.query["enum/choice"]] + +for ch, value in choices: + out(' case $value: return $name.$ch;\n') +} default: throw new Exception("no such value: " + value); + } + } + } +} |