CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

csCommandLineParser Class Reference

Utility class that makes it easier to parse the command line. More...

#include <cmdline.h>

Inheritance diagram for csCommandLineParser:

iCommandLineParser iBase List of all members.

Public Methods

 csCommandLineParser (iBase *Parent=0)
 Constructor. More...

 csCommandLineParser (int argc, const char *const argv[])
 Construct with a given command line. More...

virtual ~csCommandLineParser ()
 Destructor. More...

virtual void Initialize (int argc, const char *const argv[])
 Initialize for the given command line. More...

virtual void Reset ()
 Clear all options and names. More...

virtual const char * GetOption (const char *iName, int iIndex=0) const
 Query specific commandline option (you can query second etc. such option). More...

virtual const char * GetName (int iIndex=0) const
 Query filename specified on commandline (that is, without leading '-'). More...

virtual void AddOption (const char *iName, const char *iValue)
 Add a command-line option to the command-line option array. More...

virtual void AddName (const char *iName)
 Add a command-line name to the command-line names array. More...

virtual bool ReplaceOption (const char *iName, const char *iValue, int iIndex=0)
 Replace the Nth command-line option with a new value. More...

virtual bool ReplaceName (const char *iValue, int iIndex=0)
 Replace the Nth command-line name with a new value. More...

virtual bool GetBoolOption (const char *iName, bool defaultValue=false)
 Check for a -[no]option toggle. More...

virtual const char * GetAppDir ()
 Retrieve directory of application executable. More...


Detailed Description

Utility class that makes it easier to parse the command line.

Definition at line 47 of file csutil/cmdline.h.


Constructor & Destructor Documentation

csCommandLineParser::csCommandLineParser iBase   Parent = 0
 

Constructor.

csCommandLineParser::csCommandLineParser int    argc,
const char *const    argv[]
 

Construct with a given command line.

virtual csCommandLineParser::~csCommandLineParser   [virtual]
 

Destructor.


Member Function Documentation

virtual void csCommandLineParser::AddName const char *    iName [virtual]
 

Add a command-line name to the command-line names array.

Implements iCommandLineParser.

virtual void csCommandLineParser::AddOption const char *    iName,
const char *    iValue
[virtual]
 

Add a command-line option to the command-line option array.

Implements iCommandLineParser.

virtual const char* csCommandLineParser::GetAppDir   [virtual]
 

Retrieve directory of application executable.

Implements iCommandLineParser.

virtual bool csCommandLineParser::GetBoolOption const char *    iName,
bool    defaultValue = false
[virtual]
 

Check for a -[no]option toggle.

Implements iCommandLineParser.

virtual const char* csCommandLineParser::GetName int    iIndex = 0 const [virtual]
 

Query filename specified on commandline (that is, without leading '-').

Implements iCommandLineParser.

virtual const char* csCommandLineParser::GetOption const char *    iName,
int    iIndex = 0
const [virtual]
 

Query specific commandline option (you can query second etc. such option).

Implements iCommandLineParser.

virtual void csCommandLineParser::Initialize int    argc,
const char *const    argv[]
[virtual]
 

Initialize for the given command line.

Options from command line are added to any options already present --- i.e. those added via AddName() or AddOption().

Implements iCommandLineParser.

virtual bool csCommandLineParser::ReplaceName const char *    iValue,
int    iIndex = 0
[virtual]
 

Replace the Nth command-line name with a new value.

Implements iCommandLineParser.

virtual bool csCommandLineParser::ReplaceOption const char *    iName,
const char *    iValue,
int    iIndex = 0
[virtual]
 

Replace the Nth command-line option with a new value.

Implements iCommandLineParser.

virtual void csCommandLineParser::Reset   [virtual]
 

Clear all options and names.

Implements iCommandLineParser.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.14