In file option/goption.hh:

class option_string

Option processing class.

Inheritance:


Public Fields

typedef std::vector <std::string> arg_list
List of remainig arguments
typedef std::map <char, std::string> opt_list
List of optional arguments

Public Methods

option_string (const char* id, const char* arg, const char* optstr = 0)
Constructor
option_string (int argc, char** argv, const char* optstr = 0)
Constructor
~option_string ()
Destructor
void parse (const char* optstr)
Parse
int argc () const
Number of arguments
char* const* argv () const
List of arguments
std::string str () const
return argument string
arg_list::const_iterator argbegin () const
begin of remaining arguments
arg_list::const_iterator argend () const
end of remaining arguments
int argnum () const
Number of remaining arguments
bool opt (char c) const
Returns true if option was defined
bool getOpt (char c, std::string& value) const
get option
bool help () const
help needed?

Protected Fields

int fargc
option length
char fargv [maxarg][maxarglen]
option array
char* fargv_ptr [maxarg]
optio arra pointers
bool fError
Error flag
bool fHelp
Help flag
arg_list fArgs
Remaining arguments
opt_list fOpts
Optional arguments

Protected Methods

void addarg (const char* arg)
Add a remaining argument
void addopt (char c, const char* opt)
Add a optional argument

Documentation

Option processing class. This class supports argument processing in form of list and string. Arguments are parsed and stored in a map of pair<char,string> (optional arguments) and a list of strings (additional arguments). This class is MT safe as long as the getopt function is not used by any other thread directly.

typedef std::vector <std::string> arg_list
List of remainig arguments

typedef std::map <char, std::string> opt_list
List of optional arguments

option_string(const char* id, const char* arg, const char* optstr = 0)
Constructor. If optstr is non zero, the options are parsed.
Parameters:
id - Program name -> argv[0]
arg - Option string (as on command line)
optstr - Option list (as for getopt)

option_string(int argc, char** argv, const char* optstr = 0)
Constructor. If optstr is non zero, the options are parsed.
Parameters:
argc - Number of arguments
argv - Option list
optstr - Option list (as for getopt)

~option_string()
Destructor

void parse(const char* optstr)
Parse
Parameters:
optstr - Option list (as for getopt)

int argc() const
Number of arguments

char* const* argv() const
List of arguments

std::string str() const
return argument string

arg_list::const_iterator argbegin() const
begin of remaining arguments

arg_list::const_iterator argend() const
end of remaining arguments

int argnum() const
Number of remaining arguments

bool opt(char c) const
Returns true if option was defined

bool getOpt(char c, std::string& value) const
get option
Returns:
true if option exists
Parameters:
c - option letter
value - option value (return): string, int or double

bool help() const
help needed?

int fargc
option length

char fargv[maxarg][maxarglen]
option array

char* fargv_ptr[maxarg]
optio arra pointers

bool fError
Error flag

bool fHelp
Help flag

arg_list fArgs
Remaining arguments

opt_list fOpts
Optional arguments

void addarg(const char* arg)
Add a remaining argument

void addopt(char c, const char* opt)
Add a optional argument


This class has no child classes.

alphabetic index hierarchy of classes


Please send questions and comments to zweizig_j@ligo.caltech.edu


generated by doc++