19 using System.Collections.Generic;
37 private const char At =
'@';
38 private const char Dot =
'.';
39 public const string Object =
"System.Object";
44 new CodeNamespaceImport(
"System"),
45 new CodeNamespaceImport(
"System.Collections.Generic"),
46 new CodeNamespaceImport(
"System.Text"),
47 new CodeNamespaceImport(
"Avro"),
48 new CodeNamespaceImport(
"Avro.Specific") };
51 @"------------------------------------------------------------------------------ 53 Generated by " + System.AppDomain.CurrentDomain.FriendlyName +
", version " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version +
@" 54 Changes to this file may cause incorrect behavior and will be lost if code 57 ------------------------------------------------------------------------------");
61 "abstract",
"as",
"base",
"bool",
"break",
"byte",
"case",
"catch",
"char",
"checked",
"class",
62 "const",
"continue",
"decimal",
"default",
"delegate",
"do",
"double",
"else",
"enum",
"event",
63 "explicit",
"extern",
"false",
"finally",
"fixed",
"float",
"for",
"foreach",
"goto",
"if",
64 "implicit",
"in",
"int",
"interface",
"internal",
"is",
"lock",
"long",
"namespace",
"new",
65 "null",
"object",
"operator",
"out",
"override",
"params",
"private",
"protected",
"public",
66 "readonly",
"ref",
"return",
"sbyte",
"sealed",
"short",
"sizeof",
"stackalloc",
"static",
67 "string",
"struct",
"switch",
"this",
"throw",
"true",
"try",
"typeof",
"uint",
"ulong",
68 "unchecked",
"unsafe",
"ushort",
"using",
"virtual",
"void",
"volatile",
"while",
"value",
"partial" };
78 var builder =
new StringBuilder();
79 string[] names = name.Split(Dot);
80 for (
int i = 0; i < names.Length; ++i)
84 builder.Append(names[i]);
87 builder.Remove(builder.Length - 1, 1);
88 return builder.ToString();
98 var builder =
new StringBuilder(name.Length);
99 for (
int i = 0; i < name.Length; ++i)
101 builder.Append(name[i]);
102 return builder.ToString();
CodeNamespaceImport [] NamespaceImports
A singleton class containing data used by codegen
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
CodeCommentStatement FileComment
string UnMangle(string name)
Remove all the @
static CodeGenUtil Instance
HashSet< string > ReservedKeywords
string Mangle(string name)
Append @ to all reserved keywords that appear on the given name