Reference

ACE_Get_Opt(3)

Iterator for parsing command-line arguments.

NAME

ACE_Get_Opt - Iterator for parsing command-line arguments.

SYNOPSIS

#include <ace/Get_Opt.h>
class ACE_Get_Opt
{
  public:
    ACE_Get_Opt (
        int argc,
        ASYS_TCHAR **argv,
        const ASYS_TCHAR *optstring,
        int skip_argv0 = 1,
        int report_errors = 0
        );
    ~ACE_Get_Opt (void);
    int operator () (void);
    ASYS_TCHAR *optarg;
    int optind;
    int opterr;
    int argc_;
    ASYS_TCHAR **argv_;
    void dump (void) const;
    ACE_ALLOC_HOOK_DECLARE;
  private:
    ASYS_TCHAR *nextchar_;
    const ASYS_TCHAR *optstring_;
};

DESCRIPTION

This is a C++ wrapper for getopt(3c).

Public data members (should be hidden...).

ASYS_TCHAR *optarg;

For communication from operator() to the caller. When operator() finds an option that takes an argument, the argument value is returned here.

int optind;

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 operator(). On entry to operator(), zero means this is the first call; initialize.

When get_opt returns EOF, this is the index of the first of the non-option elements that the caller should itself scan.

Otherwise, optind communicates from one call to the next how much of argv has been scanned so far.

int opterr;

Callers store zero here to inhibit the error message for unrecognized options.

int argc_;

Holds the argc count.

ASYS_TCHAR **argv_;

Holds the argv pointer.

void dump (void) const;

Dump the state of an object.

ACE_ALLOC_HOOK_DECLARE;

Declare the dynamic allocation hooks.

AUTHOR

Doug Schmidt

LIBRARY

ace