C++ Code Documentation


File: BASE/base/Getopt.H

Parse commandline options. Places command line options into a hash.

  • struct Options;
  • Getopt( Options const *options, uint length );
    void constructor
  • virtual ~Getopt();
  • int getopt( int argc, char const * const argv[] );
    Flags is something like "c:h:op" (see getopt(3)). Flags should not start with a ":". Returns: 0: no errors 1: illegal option ( optopt() returns the option ) 2: missing argument ( optopt() returns the option ).
  • bool defined( char c );
    Returns true if the option c was used on the command line (c may be an option with or without argument).
  • base::String const &option( char c );
    Returns the argument associated with the c option if the c option was not used on the command line or is a boolean option, returns the empty string.
  • int optind();
    Returns the index into argv after the command line options and their arguments (same as the optind set by getopt(3)).
  • char optopt();
    Returns the character that caused an error.
  • base::String _optstring;
  • typedef std::map<char, base::String, std::less<char> > Opt;
  • Opt _opthash;
  • std::vector< ::option> _longoptions;
  • Getopt( Getopt const & );
    disabled copy constructor
  • Getopt &operator=( Getopt const & );
    disabled assignment operator

base::Getopt GANG