Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Arak::Util::CommandLine Class Reference

#include <parsecl.hpp>

List of all members.


Detailed Description

This class parses the command line arguments of a C/C++ program.

Definition at line 20 of file parsecl.hpp.

Public Member Functions

 CommandLine ()
 Constructor.

 ~CommandLine ()
 Destructor.

bool parse (int argc, char **argv, std::ostream &err)
 Parses the command line arguments.

void printUsage (std::ostream &out) const
 Prints the usage information to the supplied stream.

void add (Option &opt)
 Adds a new option to the options.


Protected Attributes

const char * name
 The name of the executable.

std::list< Option * > options
 A list of the options available.


Constructor & Destructor Documentation

Arak::Util::CommandLine::CommandLine  )  [inline]
 

Constructor.

Definition at line 323 of file parsecl.hpp.

References name, and options.

Arak::Util::CommandLine::~CommandLine  )  [inline]
 

Destructor.

Definition at line 328 of file parsecl.hpp.


Member Function Documentation

void Arak::Util::CommandLine::add Option opt  )  [inline]
 

Adds a new option to the options.

Parameters:
opt The new option

Definition at line 407 of file parsecl.hpp.

References options.

bool Arak::Util::CommandLine::parse int  argc,
char **  argv,
std::ostream &  err
[inline]
 

Parses the command line arguments.

Parameters:
argc the number of command line arguments
argv an array of the command line arguments
err the stream to which any parsing errors are written
Returns:
true if the parsing encountered an error

Definition at line 338 of file parsecl.hpp.

References Arak::Util::CommandLine::Option::_supplied, Arak::Util::CommandLine::Option::hasArg(), Arak::Util::CommandLine::Option::matches(), name, options, Arak::Util::CommandLine::Option::read(), Arak::Util::CommandLine::Option::required, and Arak::Util::CommandLine::Option::sflag.

void Arak::Util::CommandLine::printUsage std::ostream &  out  )  const [inline]
 

Prints the usage information to the supplied stream.

Parameters:
out the stream to write the usage information to

Definition at line 391 of file parsecl.hpp.

References name, options, and Arak::Util::CommandLine::Option::printUsage().


Member Data Documentation

const char* Arak::Util::CommandLine::name [protected]
 

The name of the executable.

Definition at line 310 of file parsecl.hpp.

Referenced by CommandLine(), parse(), and printUsage().

std::list<Option*> Arak::Util::CommandLine::options [protected]
 

A list of the options available.

This class manages the memory used by these objects.

Definition at line 316 of file parsecl.hpp.

Referenced by add(), CommandLine(), parse(), and printUsage().


The documentation for this class was generated from the following file:
Generated on Wed May 25 14:41:37 2005 for Arak by doxygen 1.3.6