Topic
Prev Next

Define Code Options

When modifying code generation templates for an existing programming language, or defining a new programming language, there are additional options that are only available when building an MDG Technology. These additional options can affect how Enterprise Architect handles code generation and reverse-engineering for this language. These options are specified using an XML file, created using your preferred text editor.

The root node in the XML document is named CodeOptions. The child nodes are named CodeOption. Each CodeOption contains a name attribute corresponding to the name of one of the available code options. The body of each node contains the option value. For example:

<CodeOptions>

     <CodeOption name="DefaultExtension">.h</CodeOption>

     <CodeOption name="HasImplementation">true</CodeOption>

     <CodeOption name="ImplementationExtension">.cpp</CodeOption>

     <CodeOption name="Editor">C:\Windows\notepad.exe</CodeOption>

</CodeOptions>

Supported code options

Code Option

Description

ConstructorName

The name of a function used as a constructor. Used by the classHasConstructor code template macro.

CopyConstructorName

The name of a function used as a copy constructor. Used by the classHasCopyConstructor code template macro.

DefaultExtension

The default extension when generating code.

DefaultSourceDirectory

The default path to which Enterprise Architect generates new files.

DestructorName

The name of a function used as a destructor. Used by the classHasDestructor code template macro.

Editor

The external editor used for editing source of this language.

HasImplementation

Specifies if code generation for this language generates both a source file and implementation file.

ImplementationExtension

The extension used by Enterprise Architect to generate an implementation file.

ImplementationPath

The relative path from the source file to generate the implementation file.

PackagePathSeparator

The delimiter used to separate Package names when using the packagePath macro from the code templates.

Notes

  • Once a language is available for use in a model (by importing and activating the MDG Technology), you can display and edit the code options on the 'Preferences' dialog ('Start > Workspace > Preferences')

Learn more