Class EnumGenerator<T>
Represents a transformation rule that generates enumerations
Inheritance
Inherited Members
Namespace: NMF.CodeGen
Assembly: NMF.CodeGen.dll
Syntax
public abstract class EnumGenerator<T> : TransformationRule<T, CodeTypeDeclaration> where T : class
Type Parameters
Name | Description |
---|---|
T | The model element type from which to generate enumerations |
Methods
| Edit this page View SourceCreateOutput(T, ITransformationContext)
Creates the code type declaration for the given input model element
Declaration
public override CodeTypeDeclaration CreateOutput(T input, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
T | input | The input model element |
ITransformationContext | context | The transformation context |
Returns
Type | Description |
---|---|
CodeTypeDeclaration | The code type declaration that will be the transformation result for the given enumeration |
Overrides
GetIsFlagged(T)
Gets a value indicating whether the enumeration is flagged
Declaration
protected virtual bool GetIsFlagged(T input)
Parameters
Type | Name | Description |
---|---|---|
T | input | The input model element from which to generate the model |
Returns
Type | Description |
---|---|
bool | True, if the enumeration is flagged, otherwise false |
GetMembers(T, CodeTypeDeclaration, ITransformationContext)
Gets the enumeration literals that should be generated for the given input model element
Declaration
protected abstract IEnumerable<EnumGenerator<T>.EnumMember> GetMembers(T input, CodeTypeDeclaration generatedType, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
T | input | The input model element |
CodeTypeDeclaration | generatedType | The generated type |
ITransformationContext | context | The context in which the enumeration is generated |
Returns
Type | Description |
---|---|
IEnumerable<EnumGenerator<T>.EnumMember> | A collection of enumeration members |
GetName(T)
Gets the name of the enumeration class
Declaration
protected abstract string GetName(T input)
Parameters
Type | Name | Description |
---|---|---|
T | input | The input model element from which to generate the enumeration class |
Returns
Type | Description |
---|---|
string | The name of the enumeration |
Transform(T, CodeTypeDeclaration, ITransformationContext)
Transform the input model element to an enumeration
Declaration
public override void Transform(T input, CodeTypeDeclaration output, ITransformationContext context)
Parameters
Type | Name | Description |
---|---|---|
T | input | The input model element that is transformed to an enumeration |
CodeTypeDeclaration | output | The output code type declaration that represents an enumeration |
ITransformationContext | context | The transformation context |