Enumeration Member Loops

 

An enumeration member loop is a template file construct which allows you to iterate through the collection of members for a particular enumeration that CodeGen has information about.  In order to use an enumeration member loop your repository must include the definition of at least one enumeration.

Enumeration member loops are delimited by a matching pair of <ENUM_MEMBER_LOOP> and </ENUM_MEMBER_LOOP> tags, which surround the template code to be inserted for each enumeration member.

The code between the opening and closing tags of an enumeration member loop is repeated for each enumeration member in the enumeration being processed. This code within an enumeration member loop can contain generic tokens, and can also contain special enumeration member loop tokens, which are discussed later. Enumeration member loop tokens can only be used inside an enumeration member loop, and an enumeration member loop can only be declared within one of the supported enumeration loop constructs.

Enumeration member loop tokens are tokens that can only be used within an enumeration member loop:

Enumeration Member Loop Expansion Tokens

Enumeration Member Loop Expression Tokens

There are two types of enumeration member loop, multi-line enumeration member loops, and on-line enumeration member loops.

Multi-Line Enumeration Member Loops

Multi-line enumeration member loops occur when the opening and closing enumeration member loop tags appear on separate lines in a template file, and delimit one or more entire lines of template code, like this:

<ENUM_LOOP>
[code]
<ENUM_MEMBER_LOOP>
code
</ENUM_MEMBER_LOOP>
[code]
</ENUM_LOOP>

Multi-line enumeration member loops generate one or more lines of output code for each enumeration member that is processed.

In-Line Enumeration Member Loops

In-line enumeration member loops exist when the opening and closing enumeration member loop tags appear on the same line in a template file, and delimit part of a line of template code, like this:

<ENUM_LOOP>
[code]
[code] <ENUM_MEMBER_LOOP> code </ENUM_MEMBER_LOOP> [code]
[code]
</ENUM_LOOP>

In-line enumeration member loops generate code into the current output line only.

 

 

 


Copyright © 2018  Synergex International, Inc.