Enumeration Loops

unlisted

Enumeration Loops

 

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

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

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

Enumeration Loop Expansion Tokens

Enumeration Loop Expression Tokens

There are three types of enumeration loop, multi-line enumeration loops, in-line enumeration loops, and structure enumeration loops.

Multi-line Enumeration Loops

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

[code]

<ENUM_LOOP>code
</ENUM_LOOP>

[code]

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

In-Line Enumeration Loops

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

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

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

The code between the opening and closing tags of an enumeration loop is repeated for each enumeration in the repository.

The code within an enumeration loop can contain generic tokens, and can also contain special enumeration loop tokens, which are discussed later.

Enumeration loop tokens can only be used inside an enumeration loop, and an enumeration loop can’t be declared within any other loop construct.

Structure Enumeration Loops

A structure enumeration loop is similar to an enumeration loop, except that only enumerations that are referenced by fields in the repository structure that is being processed are included.  As with enumeration loops, CodeGen supports both multi-line and in-line structure enumeration loops.

A multi-line structure enumeration loop looks like this:

[code]

<ENUM_LOOP_STRUCTURE>
code
</ENUM_LOOP_STRUCTURE>

[code]

And an in-line structure enumeration loop looks like this:

[code] <ENUM_LOOP_STRUCTURE> code </ENUM_LOOP_STRUCTURE> [code]

Multi-line structure enumeration loops generate one or more lines of output code for each enumeration that is processed, whereas in-line structure enumeration loops generate code into the current output line only.

 

 

 


Copyright © 2018  Synergex International, Inc.