IGeneratorConfiguration
Working with IGeneratorConfiguration requires some knowledge of regular expressions.
IGeneratorConfiguration is initially configured with a standard setup that is similar to variable identifiers in the C programming language. It includes restraint to eight characters and a digital counter at the end for resolving conflicts. This provides a turn-key solution for generating names. Any serious use of the interface should start by clearing the standard setup using IGeneratorConfiguration.Clear() followed by initialization suitable for the target application.
IGeneratorConfiguration is an interface exposed by the object implementing IGenerator. Although the default generator implements this interface, other generators may have their own configuration interface. IGenerator.Configuration returns the configuration interface as an IDispatch interface pointer, or null if it is not supported.
Almost everything done with IGeneratorConfiguration happens during initial setup. However, there are some values that are subsequently updated periodically, such as the AutoCounters, which are incremented in an attempt to avoid conflicts (duplicates).
The main features of IGeneratorConfiguration are:
Rules
Defined during initialization. Each rule is a regular expression pattern and a replacement collection. The first rule is processed first. Any text that is matched by this rule is applied to the replacement collection, and is not processed any further. Any unmatched text that occurs between sections of matched text is fed to the next rule. This rule may in turn leave unmatched text which is sent further down the rule list. Any text that is not matched by any rule is replaced by itself. Text applied to a replacement collection is substituted by the result. This may be a simple substitution, a parameter reference, a counter reference, replacement with the matched text itself, or a boundary operator. These operations can be stringed together in the replacement collection, for example to add parentheses to a word.
AutoCounters
Normally holds a single digital counter that is used to resolve conflicts. Auto in the name indicates that the counters are automatically incremented when a new variation of the generated alias is required. IGenerator.Next calls IGeneratorConfiguration.AutoCounters.Increment(). The value of the counter(s) is inserted into the alias name as specified in the Rules collection. The counters work in a similar way to parameters, except that their values are incremented rather than assigned. Each counter is referenced individually in the Rules.
FreeCounters
Used when handling multiple aliases. They are similar to AutoCounters, except that they are used for creating multiple aliases.
Parameters
Parameters are referenced by the Rules by index. Each index refers to a text that is initially empty. The index need not be sequential. For example, Parameters may contain the two parameters, 1 and 42, and Parameters.Count = 2. Additional parameters are created on the fly, simply by looking them up.
See also