gmlOptionParser Class Reference

Detailed Description

Defines the "gmlOptionParser_parse" function and the "gmlOptionParser" class. A gmlOptionParser object can parse string of "-option values" sequences.

Public Member Functions

constructor optionDescrList

Build a gmlOptionParser object. optionDescrList is the list of accepted options with their default values.

For example: "-color blue -children {}"

option subcommand option {default {}}

parse string { setDefaults 1 } { resVarName "" } { errorOnUnknown 1 }

Parses a string that contains "option value" couples.

  • string the string of "-option value" couples.
  • setDefaults if true, options that are not defined in string are defined in the result array with default values.
  • resVarName if not empty, the name of the array variable that stores the result of the parsing. If empty, the option parser object itslef is used.
  • errorOnUnknown if true, an error is generated if an unknown option is found in string. Otherwise, the unkown option and its value are ignored.

Returns the list of "option value" couples that were not parsed. This list may be non empty only if errorOnUnknown is false.

generateOptionsList

Generate the list of accepted options.

getDefault option

Return the default value for an option.

destructor

Releases resources of a gmlOptionParser object.