os::OptionParser Class Reference
[Various utillity classes.]

Command line option parser. More...

List of all members.

Public Member Functions

 OptionParser (int argc, const char *const *argv)
 ~OptionParser ()
void AddArgMap (const argmap *pasMap)
void AddArgMap (const String &cLongArg, char nShortArg, const String &cDesc)
void ParseOptions (const char *pzOptions)
int GetOptionCount () const
int GetFileCount () const
const optionFindOption (char nOpt) const
const optionFindOption (const String &cLongName) const
const optionGetNextOption ()
void RewindOptions ()
const optionGetOption (uint nIndex) const
const std::vector< String > & GetArgs () const
const std::vector< String > & GetFileArgs () const
String GetHelpText (int nWidth=0) const
void PrintHelpText (int nWidth=0) const
void PrintHelpText (StreamableIO *pcStream, int nWidth=0) const
String operator[] (int nIndex) const

Classes

struct  argmap
struct  option
class  Private


Detailed Description

Description:
os::OptionParser is a utility class that can help you parse command line options. It also have members for automatic generation of a help text suitable for the "--help" option available in most command line commands. The help text feature will format the text according to the current terminal widht (or optionally a suplied with) performing necessarry word-wrapping to make the text as readable as possible.
The rules for option parsing is mostly compatible with the GNU getopt() function. There is two kind of options. Short-options or flag start with a single "-" and ends with a single letter. Long options start with "--" and end with a string. Both short-options and long-options can have additional arguments. If a short-option take an additional argument it the next option will be used as the argument value. If a long-option take an additional argument it must be specified as "--opt=arg". All arguments that are not recognized as options will be added to a "file-list" that can later be iterated. If one of the arguments is "--" the option parsing will stop there and the rest of the arguments will be added unconditionally to the "file-list".
Since:
0.3.7
Author:
Kurt Skauen ([email protected])


Constructor & Destructor Documentation

OptionParser::OptionParser ( int  argc,
const char *const *  argv 
)

OptionParser::~OptionParser (  ) 


Member Function Documentation

void OptionParser::AddArgMap ( const argmap pasMap  ) 

void OptionParser::AddArgMap ( const String cLongArg,
char  nShortArg,
const String cDesc 
)

void OptionParser::ParseOptions ( const char *  pzOptions  ) 

int OptionParser::GetOptionCount (  )  const

int OptionParser::GetFileCount (  )  const

const OptionParser::option * OptionParser::FindOption ( char  nOpt  )  const

const OptionParser::option * OptionParser::FindOption ( const String cLongName  )  const

const OptionParser::option * OptionParser::GetNextOption (  ) 

void OptionParser::RewindOptions (  ) 

const OptionParser::option * OptionParser::GetOption ( uint  nIndex  )  const

const std::vector< String > & OptionParser::GetArgs (  )  const

const std::vector< String > & OptionParser::GetFileArgs (  )  const

String OptionParser::GetHelpText ( int  nWidth = 0  )  const

void OptionParser::PrintHelpText ( int  nWidth = 0  )  const

void OptionParser::PrintHelpText ( StreamableIO pcStream,
int  nWidth = 0 
) const

String OptionParser::operator[] ( int  nIndex  )  const


Generated on Sat May 9 22:51:15 2009 for Syllable higlevel API by  doxygen 1.5.1