C# Class BACnet.SchemaCompiler.CodeGen.CSharpTypeGenerator

Datei anzeigen Open project: LorenVS/bacstack Class Usage Examples

Public Methods

Method Description
CSharpTypeGenerator ( string directory, string ns ) : System

Constructs a new csharp type generator instance

Generate ( NamedType type ) : void

Generates code for a named type

Private Methods

Method Description
_choiceOptionNeedsWrapper ( FieldDefinition field ) : bool

Determines whether a choice option requires a wrapper type

_fieldNameToTempName ( string fieldName ) : string

Transforms a field name into a temporary variable name

_fieldNameToTypeName ( string fieldName ) : string

Transforms a field name to a type name for an anonymous type

_generateArrayType ( CSharpEmitter emitter, string typeName, string fieldName, ArrayDefinition def, bool root ) : void

Generates an array type

_generateBitString ( CSharpEmitter emitter, string typeName, string fieldName, BitStringDefinition def ) : void

Generates a bit string type

_generateChoice ( CSharpEmitter emitter, string typeName, string fieldName, ChoiceDefinition def, bool root = false ) : void

Generates a choice type

_generateChoiceOption ( CSharpEmitter emitter, string choiceName, FieldDefinition field ) : void

Generates a choice option

_generateChoiceOptionWrappers ( CSharpEmitter emitter, string choiceName, ChoiceDefinition def ) : void

If necessary, generates a wrapper for each non-sequence, non-choice option

_generateChoiceOptions ( CSharpEmitter emitter, string name, ChoiceDefinition def ) : void

Generates the option types for a choice

_generateChoiceTags ( CSharpEmitter emitter, ChoiceDefinition def ) : void

Generates the tags enumeration for a choice

_generateDefinition ( CSharpEmitter emitter, string name, string fieldName, TypeDefinition def, bool root = false, string tag = null, string choiceBase = null ) : void

Generates a definition

_generateEnumeration ( CSharpEmitter emitter, string typeName, string fieldName, EnumerationDefinition def ) : void

Generates an enumeration type

_generateNameType ( CSharpEmitter emitter, string typeName, string fieldName, NameDefinition def, bool root ) : void

Generates an name alias type

_generateOptionType ( CSharpEmitter emitter, string typeName, string fieldName, OptionDefinition def, bool root ) : void

Generates an option type

_generatePrimitiveType ( CSharpEmitter emitter, string typeName, string fieldName, PrimitiveDefinition def, bool root ) : void

Generates an array type

_generateSequence ( CSharpEmitter emitter, string typeName, string fieldName, SequenceDefinition def, bool root = false, string tag = null, string choiceBase = null ) : void

Generates a sequence type

_generateSequenceFields ( CSharpEmitter emitter, SequenceDefinition def ) : void

Generates types for sequence fields

_generateWrapperType ( CSharpEmitter emitter, string name, string wrappedType, string choiceBase = null, string tag = null ) : CSharpEmitter

Generates a wrapper type

_getChoiceOptionForwardedParameters ( FieldDefinition field ) : Parameter[]

Gets the parameters that need to be forwarded to a choice option's constructor

_getDefinitionName ( string typeName, string fieldName, TypeDefinition definition ) : string

Gets the type name for a defined type

_sequenceFieldEffectiveNameForType ( FieldDefinition field ) : string

Returns the effective field name for a sequence field that is used to determine the type name for the field

_sequenceFieldNeedsTypeSuffix ( FieldDefinition field ) : bool

Determines whether a sequence field type name needs -type appended to it so it won't conflict with a property name

_sequenceFieldTypeName ( FieldDefinition field ) : string

Returns the type name for a sequence field

_transformFieldName ( string name ) : string

Gets a CSharp field name from

_transformTypeName ( string name ) : string

Gets a CSharp type name from a definition name

Method Details

CSharpTypeGenerator() public method

Constructs a new csharp type generator instance
public CSharpTypeGenerator ( string directory, string ns ) : System
directory string The directory to place generated files
ns string The namespace of the generated types
return System

Generate() public method

Generates code for a named type
public Generate ( NamedType type ) : void
type BACnet.SchemaParser.NamedType The type to generate for
return void