iCommandLineParser Struct Reference
[Utilities]
A utility class that makes it easier to parse the command line.
More...
#include <iutil/cmdline.h>
Inheritance diagram for iCommandLineParser:
Public Member Functions | |
virtual void | AddName (const char *iName)=0 |
Add a command-line name to the command-line names array. | |
virtual void | AddOption (const char *iName, const char *iValue)=0 |
Add a command-line option to the command-line option array. | |
virtual const char * | GetAppDir ()=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 char * | GetAppPath ()=0 |
Returns the full path to the application executable. | |
virtual bool | GetBoolOption (const char *iName, bool defaultValue=false)=0 |
Check for a -[no]option toggle. | |
virtual const char * | GetName (size_t iIndex=0) const =0 |
Query filename specified on commandline (that is, without leading '-'). | |
virtual const char * | GetOption (const char *iName, size_t iIndex=0) const =0 |
Query specific commandline option (you can query second etc. such option). | |
virtual const char * | GetOptionName (size_t iIndex) const =0 |
Query the name of the Nth command line option. | |
virtual const char * | GetResourceDir ()=0 |
Returns the directory in which the application's resources resides. | |
virtual void | Initialize (int argc, const char *const argv[])=0 |
Initialize for the given command line. | |
virtual bool | ReplaceName (const char *iValue, size_t iIndex=0)=0 |
Replace the Nth command-line name with a new value. | |
virtual bool | ReplaceOption (const char *iName, const char *iValue, size_t iIndex=0)=0 |
Replace the Nth command-line option with a new value. | |
virtual void | Reset ()=0 |
Clear all options and names. |
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 41 of file cmdline.h.
Member Function Documentation
virtual void iCommandLineParser::AddName | ( | const char * | iName | ) | [pure virtual] |
virtual void iCommandLineParser::AddOption | ( | const char * | iName, | |
const char * | iValue | |||
) | [pure virtual] |
virtual const char* 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 char* iCommandLineParser::GetAppPath | ( | ) | [pure virtual] |
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 | ( | size_t | 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, | |
size_t | iIndex = 0 | |||
) | const [pure virtual] |
Query specific commandline option (you can query second etc. such option).
Implemented in csCommandLineParser.
virtual const char* iCommandLineParser::GetOptionName | ( | size_t | iIndex | ) | const [pure virtual] |
virtual const char* 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, | |
size_t | iIndex = 0 | |||
) | [pure virtual] |
virtual bool iCommandLineParser::ReplaceOption | ( | const char * | iName, | |
const char * | iValue, | |||
size_t | iIndex = 0 | |||
) | [pure virtual] |
virtual void iCommandLineParser::Reset | ( | ) | [pure virtual] |
The documentation for this struct was generated from the following file:
- iutil/cmdline.h
Generated for Crystal Space by doxygen 1.4.7