sc::GetLongOpt Class Reference

Parse command line options. More...

#include <util/options/GetLongOpt.h>

List of all members.

Public Types

enum  OptType { NoValue, OptionalValue, MandatoryValue }
 Used by the enroll member to specify whether or not a value is expected or optional. More...

Public Member Functions

 GetLongOpt (const char optmark= '-')
 Initialize the object.
int parse (int argc, char *const *argv)
 Parse command line options.
int parse (char *const str, char *const p)
 Parse options in a string.
int enroll (const char *const opt, const OptType t, const char *const desc, const char *const val)
 Enroll an option.
const char * retrieve (const char *const opt) const
 Retrieve an option.
void usage (std::ostream &outfile=std::cout) const
 Print usage information.
void usage (const char *str)
 Initialize usage synopsis.

Classes

struct  Cell


Detailed Description

Parse command line options.

Member Enumeration Documentation

Used by the enroll member to specify whether or not a value is expected or optional.


Constructor & Destructor Documentation

sc::GetLongOpt::GetLongOpt ( const char  optmark = '-'  ) 

Initialize the object.

Parameters:
optmark the option flag marker (default is -).


Member Function Documentation

int sc::GetLongOpt::parse ( int  argc,
char *const *  argv 
)

Parse command line options.

Parameters:
argc the number of arguments, as passed to main
argv the arguments, as passed to main
Returns:
the index to the start of arguments that were not processed (an error occurred if the return value is < 1)

int sc::GetLongOpt::parse ( char *const   str,
char *const   p 
)

Parse options in a string.

Parameters:
str the string to be parsed
p a prefix that will be prefixed to error messages
Returns:
the index to the start of arguments that were not processed (an error occurred if the return value is < 1)

int sc::GetLongOpt::enroll ( const char *const   opt,
const OptType  t,
const char *const   desc,
const char *const   val 
)

Enroll an option.

Parameters:
opt the option name
t whether or not a value is expected
desc a description of the option
val a default value for the option with an optional value

const char* sc::GetLongOpt::retrieve ( const char *const   opt  )  const

Retrieve an option.

Parameters:
opt the name of the option

void sc::GetLongOpt::usage ( std::ostream &  outfile = std::cout  )  const

Print usage information.

Parameters:
outfile stream to use for printing (default: std::cout)

void sc::GetLongOpt::usage ( const char *  str  )  [inline]

Initialize usage synopsis.

Parameters:
str the usage synopsis


The documentation for this class was generated from the following file:

Generated at Sun Feb 22 10:13:10 2009 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.5.6.
These pages are hosted on SourceForge.net