<StringOpt letter="d" name="sample_dates"> <Length max="9" min="3"/> <Required/> <Multiple/> <Validator name="val_date" linkage="C"/> </StringOpt>
<StringOpt letter="h" name="host" default="localhost"/>
If the option is not present on the command line, the generated code will store the value of the default attribute as the argument of the option. If no default attribute is supplied, the default default is an empty string. The default attribute has no effect if the <Required/> or <Multiples/> element is present.
The value of the name attribute is the name of a validation function of type int. This function should accept a const char * as its parameter, return zero for a valid argument, and return non-zero for an invalid argument. Typically it should issue specific error messages to standard error as needed, since the generated code will issue only a generic error message complaining about an invalid argument. Aargh does not try to verify that the value of the name attribute is a valid function name in the target language.
The linkage attribute is useful only for generating C++. Its value specifies the linkage type of the validating function. In particular, if the value is "C", then the generated header file will declare the validator function as extern "C". If you specify "C++", or if you omit the linkage attribute, aargh will omit the extern qualifier and linkage specification from the generated header file. You can use other linkage types, such as "pascal", if your C++ compiler supports them.
struct optionname_node
{
struct optionname_node * pNext;
char * value;
};
...where optionname is the name of the option. The nodes are
linked in the order in which the options occur. The first node represents
the first occurrence, the second represents the second, and so on.
For C++ no such function is necessary. The list of values is stored in an STL vector, which is automatically cleared by the destructor.void clear_Opts( struct Opts * pOpts );
:w