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.

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

virtual ~csCommandLineParser ()
 Destructor.

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

virtual void Reset ()
 Clear all options and names.

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

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

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

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

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

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

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

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

virtual const csStringGetAppDir ()
 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 ()
 Returns the full path to the application executable.


Detailed Description

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

Definition at line 47 of file 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 csString& csCommandLineParser::GetAppDir   [virtual]
 

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

Implements iCommandLineParser.

virtual const csString& csCommandLineParser::GetAppPath   [virtual]
 

Returns the full path to the 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 const csString& csCommandLineParser::GetResourceDir   [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.

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.18