Table of Contents

Class EnumGenerator<T>

Namespace
NMF.CodeGen
Assembly
NMF.CodeGen.dll

Represents a transformation rule that generates enumerations

public abstract class EnumGenerator<T> : TransformationRule<T, CodeTypeDeclaration> where T : class

Type Parameters

T

The model element type from which to generate enumerations

Inheritance
EnumGenerator<T>
Derived
Inherited Members

Methods

CreateOutput(T, ITransformationContext)

Creates the code type declaration for the given input model element

public override CodeTypeDeclaration CreateOutput(T input, ITransformationContext context)

Parameters

input T

The input model element

context ITransformationContext

The transformation context

Returns

CodeTypeDeclaration

The code type declaration that will be the transformation result for the given enumeration

GetIsFlagged(T)

Gets a value indicating whether the enumeration is flagged

protected virtual bool GetIsFlagged(T input)

Parameters

input T

The input model element from which to generate the model

Returns

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

protected abstract IEnumerable<EnumGenerator<T>.EnumMember> GetMembers(T input, CodeTypeDeclaration generatedType, ITransformationContext context)

Parameters

input T

The input model element

generatedType CodeTypeDeclaration

The generated type

context ITransformationContext

The context in which the enumeration is generated

Returns

IEnumerable<EnumGenerator<T>.EnumMember>

A collection of enumeration members

GetName(T)

Gets the name of the enumeration class

protected abstract string GetName(T input)

Parameters

input T

The input model element from which to generate the enumeration class

Returns

string

The name of the enumeration

Transform(T, CodeTypeDeclaration, ITransformationContext)

Transform the input model element to an enumeration

public override void Transform(T input, CodeTypeDeclaration output, ITransformationContext context)

Parameters

input T

The input model element that is transformed to an enumeration

output CodeTypeDeclaration

The output code type declaration that represents an enumeration

context ITransformationContext

The transformation context