#include <Get_Opt.h>
Collaboration diagram for ACE_Get_Opt:

Public Types | |
| enum | { REQUIRE_ORDER = 1, PERMUTE_ARGS = 2, RETURN_IN_ORDER = 3 } |
| Mutually exclusive ordering values. More... | |
| enum | OPTION_ARG_MODE { NO_ARG = 0, ARG_REQUIRED = 1, ARG_OPTIONAL = 2 } |
| Mutually exclusive option argument mode used by long options. More... | |
Public Methods | |
| ACE_Get_Opt (int argc, ACE_TCHAR **argv, const ACE_TCHAR *optstring, int skip_args=1, int report_errors=0, int ordering=PERMUTE_ARGS, int long_only=0) | |
| ~ACE_Get_Opt (void) | |
| Default dtor. More... | |
| int | operator() (void) |
| ACE_TCHAR * | opt_arg (void) const |
| int | opt_opt (void) |
| int & | opt_ind (void) |
| int | long_option (const ACE_TCHAR *name, OPTION_ARG_MODE has_arg=NO_ARG) |
| Adds a long option with no corresponding short option. More... | |
| int | long_option (const ACE_TCHAR *name, int short_option, OPTION_ARG_MODE has_arg=NO_ARG) |
| Adds a long option with a corresponding short option. More... | |
| const ACE_TCHAR * | long_option (void) const |
Returns the name of the long option found on the last call to operator() or 0 if none was found. More... | |
| int | argc (void) const |
The number of arguments in the internal argv_. More... | |
| ACE_TCHAR ** | argv (void) const |
Accessor for the internal argv_ pointer. More... | |
| void | dump (void) const |
| Dump the state of an object. More... | |
| const ACE_TCHAR * | optstring (void) const |
| Return the optstring. This is handy to verify that calls to long_option added short options as expected. More... | |
Public Attributes | |
| int | argc_ |
| Holds the argc count. More... | |
| ACE_TCHAR ** | argv_ |
| Holds the argv pointer. More... | |
| int | optind |
Index in argv_ of the next element to be scanned. More... | |
| int | opterr |
| Callers store zero here to inhibit the error message for unrecognized options. More... | |
| ACE_TCHAR * | optarg |
Points to the option argument when one is found on last call to operator(). More... | |
Private Methods | |
| int | nextchar_i (void) |
| Updates nextchar_. More... | |
| int | long_option_i (void) |
| Handles long options. More... | |
| int | short_option_i (void) |
| Handles short options. More... | |
| void | permute_args (void) |
| If permuting args, this functions manages the nonopt_start_ and nonopt_end_ indexes and makes calls to permute to actually reorder the <argv>-elements. More... | |
| int | permute (void) |
| Handles reordering <argv>-elements. More... | |
| ACE_Get_Opt (const ACE_Get_Opt &) | |
| ACE_Get_Opt & | operator= (const ACE_Get_Opt &) |
Private Attributes | |
| ACE_TString | optstring_ |
| Holds the option string. More... | |
| int | long_only_ |
| Treat all options as long options. More... | |
| int | has_colon_ |
| Keeps track of whether or not a colon was passed in <optstring>. This is used to determine the return value when required arguments are missing. More... | |
| ACE_TCHAR * | nextchar_ |
| int | optopt_ |
| Most recently matched short option character. More... | |
| int | ordering_ |
| Keeps track of ordering mode (default <PERMUTE_ARGS>). More... | |
| int | nonopt_start_ |
| Index of the first non-option <argv>-element found (only valid when permuting). More... | |
| int | nonopt_end_ |
| Index of the <argv>-element following the last non-option element (only valid when permuting). More... | |
| ACE_Get_Opt_Long_Option * | long_option_ |
| Points to the long_option found on last call to <operator()>. More... | |
| ACE_Array< ACE_Get_Opt_Long_Option *> | long_opts_ |
| Array of long options. More... | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. More... | |
This is a C++ wrapper for getopt(3c) and getopt_long(3c).
|
|
Mutually exclusive ordering values.
|
|
|
Mutually exclusive option argument mode used by long options.
|
|
||||||||||||||||||||||||||||||||
|
Constructor initializes the command line to be parsed. All information for parsing must be supplied to this constructor.
abc:" or "abc::" then the command line "program -abcxxx" short options a, b, and c are found with "xxx" as the argument for c. However, if the command line is specified as "program -acb" only options a and c are found with "b" as the argument for c. Also, for options with optional arguments, that is, those followed by "::", the argument must be in the same argv element, so "program -abc xxx" will only find "xxx" as the argument for c if optstring is specified as "abc:" not "abc::". |
|
|
Default dtor.
|
|
|
|
|
|
The number of arguments in the internal
|
|
|
Accessor for the internal
|
|
|
Dump the state of an object.
|
|
|
Returns the name of the long option found on the last call to
|
|
||||||||||||||||
|
Adds a long option with a corresponding short option.
|
|
||||||||||||
|
Adds a long option with no corresponding short option.
If the name option is seen,
|
|
|
Handles long options.
|
|
|
Updates nextchar_.
|
|
|
Scan elements of argv (whose length is argc) for short option characters given in optstring or long options (with no short option equivalents).
If an element of argv starts with '-', and is not exactly "-" or "--", then it is a short option element. The characters of this element (aside from the initial '-') are option characters. If it starts with "--" followed by other characters it is treated as a long option. If
|
|
|
|
|
|
For communication from |
|
|
Index in argv of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to
When
Otherwise, |
|
|
Returns the most recently matched option character. Especially useful when operator() returns ':' for an unspecified argument that's required, since this allows the caller to learn what option was specified without its required argument. |
|
|
Return the optstring. This is handy to verify that calls to long_option added short options as expected.
|
|
|
Handles reordering <argv>-elements.
|
|
|
If permuting args, this functions manages the nonopt_start_ and nonopt_end_ indexes and makes calls to permute to actually reorder the <argv>-elements.
|
|
|
Handles short options.
|
|
|
Declare the dynamic allocation hooks.
|
|
|
Holds the argc count.
|
|
|
Holds the argv pointer.
|
|
|
Keeps track of whether or not a colon was passed in <optstring>. This is used to determine the return value when required arguments are missing.
|
|
|
Treat all options as long options.
|
|
|
Points to the long_option found on last call to <operator()>.
|
|
|
Array of long options.
|
|
|
The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off * If this is zero, or a null string, it means resume the scan by advancing to the next <argv>-element. |
|
|
Index of the <argv>-element following the last non-option element (only valid when permuting).
|
|
|
Index of the first non-option <argv>-element found (only valid when permuting).
|
|
|
Points to the option argument when one is found on last call to
|
|
|
Callers store zero here to inhibit the error message for unrecognized options.
|
|
|
Index in
|
|
|
Most recently matched short option character.
|
|
|
Holds the option string.
|
|
|
Keeps track of ordering mode (default <PERMUTE_ARGS>).
|
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001