CLI attributes are defined through the C++ property view of a Class, by choosing the “CLI Attribute” value in the “Class kind” field.
CLI attribute property view
This view defines all options available on the CLI Attribute definition.
Allows multiple CLI attribute: Specifies whether or not the multiplicity of this CLI attribute is allowed.
Add attribute inheritance: Specifies whether or not the CLI attribute is inherited.
Attribute targets: Specifies the types of elements where the attribute is applicable.
Indexers are modeled through a UML class with two operations, “get” and “set”, to which the <<CLI Indexer>> stereotype is added.
A class stereotyped <<CLI Indexer>> will not be generated. It will simply be used to generate C# indexer get and set signatures and bodies.
To create an indexer, simply use the creation command from the contextual menu on a class, as shown below.
The “Create CLI Indexer” command
The following is a description of indexer accessors:
CLI events are modeled throught a UML signal to which the <<CLI Event>> stereotype is added. This signal must be a part of a class. Once a signal is stereotyped as an event, you can manage new values such as visibility (using the C++ property view) and delegate association (using Signal UML properties tab’s base field). An event must refer to a model’s delegate.
To create a CLI event, simply use the creation command from the contextual menu on a class, as shown below.
The “Create CLI Event” command
Delegates can be operations issued from delegate containers (classes stereotyped <<CLI Delegate Container>>) or delegates (operations stereotyped <<CLI Delegate>>). The related reference can be created through a drag and drop operation.
Delegate containers (classes stereotyped <<CLI Delegate Container>>) are used as containers of C# delegate types (operations stereotyped <<CLI Delegate>>). The generated delegates belong to the current parent element.
Making an operation <<CLI Delegate>> through the C++ property page will enable delegate signature and skip generation of all code notes attached to the operation.
CLI properties are modeled throught a UML attribute or association end, to which the <<CLI Property>> stereotype is added.
To obtain the property declaration with simplified syntax, you must not define any associated code notes (“CLI Getter Code”/“CLI Setter Code”), as if you do, a normal property will be generated.
The generator will automatically generate the get or set accessors according to which access mode has been selected.
Example of an integer property