CommandLine Struct Reference

#include <rcudata/Options.h>


Detailed Description

Class to deal with command line options.
Examples:

createAddresses.cxx, createConfigs.cxx, createParams.cxx, createPriority.cxx, createTables.cxx, createValues.cxx, dropTables.cxx, and rcuconf.cxx.

Definition at line 224 of file Options.h.

Public Member Functions

 CommandLine (const char *args="")
bool Process (int argc, char **argv)
std::vector< std::string > & Remain ()
void Add (OptionBase &option)
void Help () const

Protected Types

typedef std::set< OptionBase * > OptionList

Protected Member Functions

void GetLong (const char *str, std::string &opt, std::string &val)
int CheckOptions (const std::string &opt, const std::string &arg)
int CheckOptions (char s, const char *arg)

Protected Attributes

std::string fArg
std::string fProg
OptionList fList
std::vector< std::string > fRemain


Member Typedef Documentation

typedef std::set<OptionBase*> CommandLine::OptionList [protected]
 

Type of list of options.

Definition at line 330 of file Options.h.


Constructor & Destructor Documentation

CommandLine::CommandLine const char *  args = ""  )  [inline]
 

Constructor.

Parameters:
args Help string

Definition at line 228 of file Options.h.

References fArg.


Member Function Documentation

void CommandLine::Add OptionBase option  )  [inline]
 

Add an option.

Parameters:
option Option to add
Examples:
createAddresses.cxx, createConfigs.cxx, createParams.cxx, createPriority.cxx, createTables.cxx, createValues.cxx, dropTables.cxx, and rcuconf.cxx.

Definition at line 265 of file Options.h.

References fList.

Referenced by main().

int CommandLine::CheckOptions char  s,
const char *  arg
[inline, protected]
 

Loop over all defined options, and check if one can handle the given long option.

Parameters:
s short option string
arg Possible argument
Returns:
negative in case of errors, positive if succcessful, and the argument arg was processed, or 0 if successful and argument arg not processed.

Definition at line 315 of file Options.h.

References fList.

int CommandLine::CheckOptions const std::string &  opt,
const std::string &  arg
[inline, protected]
 

Loop over all defined options, and check if one can handle the given short option.

Parameters:
opt Short option character
arg Possible argument
Returns:
negative in case of errors, positive if succcessful, and the argument arg was processed, or 0 if successful and argument arg not processed.

Definition at line 302 of file Options.h.

References fList.

Referenced by Process().

void CommandLine::GetLong const char *  str,
std::string &  opt,
std::string &  val
[inline, protected]
 

Decode a long option.

Parameters:
str option and argument string to decode
opt Decoded option string
val Argument string.

Definition at line 283 of file Options.h.

Referenced by Process().

void CommandLine::Help  )  const [inline]
 

Print help information.

Examples:
createAddresses.cxx, createConfigs.cxx, createParams.cxx, createPriority.cxx, createTables.cxx, createValues.cxx, dropTables.cxx, and rcuconf.cxx.

Definition at line 270 of file Options.h.

References fArg, fList, and fProg.

Referenced by main().

bool CommandLine::Process int  argc,
char **  argv
[inline]
 

Process the command line.

Parameters:
argc Number of arguments
argv Arguments
Returns:
true on success, false otherwise
Examples:
createAddresses.cxx, createConfigs.cxx, createParams.cxx, createPriority.cxx, createTables.cxx, createValues.cxx, dropTables.cxx, and rcuconf.cxx.

Definition at line 233 of file Options.h.

References CheckOptions(), fProg, fRemain, and GetLong().

Referenced by main().

std::vector<std::string>& CommandLine::Remain  )  [inline]
 

Returns:
Vector of remaining arguments not handled by any option

Definition at line 262 of file Options.h.

References fRemain.


Field Documentation

std::string CommandLine::fArg [protected]
 

Extra help.

Definition at line 326 of file Options.h.

Referenced by CommandLine(), and Help().

OptionList CommandLine::fList [protected]
 

List of options.

Definition at line 332 of file Options.h.

Referenced by Add(), CheckOptions(), and Help().

std::string CommandLine::fProg [protected]
 

Program name.

Definition at line 328 of file Options.h.

Referenced by Help(), and Process().

std::vector<std::string> CommandLine::fRemain [protected]
 

List of remaining options.

Definition at line 334 of file Options.h.

Referenced by Process(), and Remain().


The documentation for this struct was generated from the following file:
Top of page Last update Fri Apr 27 01:54:16 2007
Copyright © 2004 Christian Holm Created by DoxyGen 1.3.5