CrystalSpace

Public API Reference

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

iCommandLineParser Struct Reference
[Utilities]

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

#include <cmdline.h>

Inheritance diagram for iCommandLineParser:

iBase csCommandLineParser List of all members.

Public Methods

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

virtual void Reset ()=0
 Clear all options and names.

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

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

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

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

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

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

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

virtual const csStringGetResourceDir ()=0
 Returns the directory in which the application's resources resides.

virtual const csStringGetAppDir ()=0
 Returns the directory in which the application executable resides; or the directory in which the Cocoa application wrapper resides on MacOS/X.

virtual const csStringGetAppPath ()=0
 Returns the full path to the application executable.


Detailed Description

A utility class that makes it easier to parse the command line.

Main creators of instances implementing this interface:

Main ways to get pointers to this interface:

Definition at line 44 of file cmdline.h.


Member Function Documentation

virtual void iCommandLineParser::AddName const char *    iName [pure virtual]
 

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

Implemented in csCommandLineParser.

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

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

Implemented in csCommandLineParser.

virtual const csString& iCommandLineParser::GetAppDir   [pure virtual]
 

Returns the directory in which the application executable resides; or the directory in which the Cocoa application wrapper resides on MacOS/X.

Implemented in csCommandLineParser.

virtual const csString& iCommandLineParser::GetAppPath   [pure virtual]
 

Returns the full path to the application executable.

Implemented in csCommandLineParser.

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

Check for a -[no]option toggle.

The difference to using GetOption() to check for the two possibilities is that this function respects the argument order.
Example: the result of evaluating the arguments -option -nooption would depend on if you either check for "option" or "nooption" using GetOption(), while GetBoolOption() returns false because it looks for the last toggle argument.

Parameters:
iName  The name of the positive toggle argument. The negative argument is created by inserting "no" in front of it.
defaultValue  The default value, if neither of the toggle arguments is found.

Implemented in csCommandLineParser.

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

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

Implemented in csCommandLineParser.

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

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

Implemented in csCommandLineParser.

virtual const csString& iCommandLineParser::GetResourceDir   [pure virtual]
 

Returns the directory in which the application's resources resides.

On many platforms, this may be the same as the directory returned by GetAppDir(); however, on MacOS/X, it is the "Resources" directory within the Cocoa application wrapper.

Implemented in csCommandLineParser.

virtual void iCommandLineParser::Initialize int    argc,
const char *const    argv[]
[pure 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().

Implemented in csCommandLineParser.

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

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

Implemented in csCommandLineParser.

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

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

Implemented in csCommandLineParser.

virtual void iCommandLineParser::Reset   [pure virtual]
 

Clear all options and names.

Implemented in csCommandLineParser.


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