## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# csCommandLineParser Class Reference

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

`#include <csutil/cmdline.h>`

Inheritance diagram for csCommandLineParser:

[legend]
List of all members.

## Public Member Functions

virtual void | AddName (const char *iName)
| Add a command-line name to the command-line names array.
virtual void | AddOption (const char *iName, const char *iValue)
| Add a command-line option to the command-line option array.
| csCommandLineParser (int argc, const char *const argv[])
| Construct with a given command line.
| csCommandLineParser (iBase *Parent=0)
| Constructor.
virtual const char * | GetAppDir ()
| 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 ()
| Returns the full path to the application executable.
virtual bool | GetBoolOption (const char *iName, bool defaultValue=false)
| Check for a -[no]option toggle.
virtual const char * | GetName (size_t iIndex=0) const
| Query filename specified on commandline (that is, without leading '-').
virtual const char * | GetOption (const char *iName, size_t iIndex=0) const
| Query specific commandline option (you can query second etc. such option).
virtual const char * | GetResourceDir ()
| Returns the directory in which the application's resources resides.
virtual void | Initialize (int argc, const char *const argv[])
| Initialize for the given command line.
virtual bool | ReplaceName (const char *iValue, size_t iIndex=0)
| Replace the Nth command-line name with a new value.
virtual bool | ReplaceOption (const char *iName, const char *iValue, size_t iIndex=0)
| Replace the Nth command-line option with a new value.
virtual void | Reset ()
| Clear all options and names.
virtual | ~csCommandLineParser ()
| Destructor.

## Detailed Description

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

Definition at line 53 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 char* 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 char* 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 | ( | size_t | iIndex = `0` | ) | const`[virtual]`

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

virtual const char* csCommandLineParser::GetOption | ( | const char * | iName,
|  | size_t | iIndex = `0`
| ) | const`[virtual]`

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

virtual const char* 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,
|  | size_t | 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,
|  | size_t | 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:

- csutil/cmdline.h