crystalspace.jbind.interfaces.iutil.cmdline
Interface iCommandLineParser

All Superinterfaces:
iBase, iPointer
All Known Implementing Classes:
csCommandLineParser

public interface iCommandLineParser
extends iBase

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

Author:
Java wrapper - Quentin Anciaux, c++ version - http://crystal.sourceforge.net/docs/online/devapi/structiCommandLineParser.php

Method Summary
 void addName(java.lang.String iName)
          Add a command-line name to the command-line names array.
 void addOption(java.lang.String iName, java.lang.String iValue)
          Add a command-line option to the command-line option array.
 java.lang.String getAppDir()
          Returns the directory in which the application executable resides; or the directory in which the Cocoa application wrapper resides on MacOS/X.
 java.lang.String getAppPath()
          Returns the full path to the application executable.
 boolean getBoolOption(java.lang.String iName)
          Check for a -[no]option toggle.
 boolean getBoolOption(java.lang.String iName, boolean defaultValue)
          Check for a -[no]option toggle.
 java.lang.String getName()
          Query filename specified on commandline (that is, without leading '-');.
 java.lang.String getName(int iIndex)
          Query filename specified on commandline (that is, without leading '-');.
 java.lang.String getOption(java.lang.String iName)
          Query specific commandline option (you can query second etc. such option);.
 java.lang.String getOption(java.lang.String iName, int iIndex)
          Query specific commandline option (you can query second etc. such option);.
 java.lang.String getResourceDir()
          Returns the directory in which the application's resources resides.
 void initialize(java.lang.String[] argv)
          Initialize for the given command line.
 boolean replaceName(java.lang.String iValue)
          Replace the Nth command-line name with a new value.
 boolean replaceName(java.lang.String iValue, int iIndex)
          Replace the Nth command-line name with a new value.
 boolean replaceOption(java.lang.String iName, java.lang.String iValue)
          Replace the Nth command-line option with a new value.
 boolean replaceOption(java.lang.String iName, java.lang.String iValue, int iIndex)
          Replace the Nth command-line option with a new value.
 void reset()
          Clear all options and names.
 
Methods inherited from interface crystalspace.jbind.interfaces.iutil.scf.iBase
decRef, getRefCount, getVersion, incRef, queryInterface, queryInterfaceSafe
 
Methods inherited from interface crystalspace.jbind.interfaces.iPointer
changePointer, getPointer, isMemoryOwner, setMemoryOwner
 

Method Detail

addName

public void addName(java.lang.String iName)
Add a command-line name to the command-line names array. Implemented in csCommandLineParser.

Parameters:
iName -

addOption

public void addOption(java.lang.String iName,
                      java.lang.String iValue)
Add a command-line option to the command-line option array. Implemented in csCommandLineParser.

Parameters:
iName -
iValue -

getAppDir

public java.lang.String getAppDir()
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.

Returns:

getAppPath

public java.lang.String getAppPath()
Returns the full path to the application executable. Implemented in csCommandLineParser.

Returns:

getBoolOption

public boolean getBoolOption(java.lang.String iName)
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.

Parameters:
iName -
Returns:

getBoolOption

public boolean getBoolOption(java.lang.String iName,
                             boolean defaultValue)
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.

Parameters:
iName -
defaultValue -
Returns:

getName

public java.lang.String getName()
Query filename specified on commandline (that is, without leading '-');. Implemented in csCommandLineParser.

Specified by:
getName in interface iBase
Returns:

getName

public java.lang.String getName(int iIndex)
Query filename specified on commandline (that is, without leading '-');. Implemented in csCommandLineParser.

Parameters:
iIndex -
Returns:

getOption

public java.lang.String getOption(java.lang.String iName)
Query specific commandline option (you can query second etc. such option);. Implemented in csCommandLineParser.

Parameters:
iName -
Returns:

getOption

public java.lang.String getOption(java.lang.String iName,
                                  int iIndex)
Query specific commandline option (you can query second etc. such option);. Implemented in csCommandLineParser.

Parameters:
iName -
iIndex -
Returns:

getResourceDir

public java.lang.String getResourceDir()
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.

Returns:

initialize

public void initialize(java.lang.String[] argv)
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.

Parameters:
argv -

replaceName

public boolean replaceName(java.lang.String iValue)
Replace the Nth command-line name with a new value. Implemented in csCommandLineParser.

Parameters:
iValue -
Returns:

replaceName

public boolean replaceName(java.lang.String iValue,
                           int iIndex)
Replace the Nth command-line name with a new value. Implemented in csCommandLineParser.

Parameters:
iValue -
iIndex -
Returns:

replaceOption

public boolean replaceOption(java.lang.String iName,
                             java.lang.String iValue)
Replace the Nth command-line option with a new value. Implemented in csCommandLineParser.

Parameters:
iName -
iValue -
Returns:

replaceOption

public boolean replaceOption(java.lang.String iName,
                             java.lang.String iValue,
                             int iIndex)
Replace the Nth command-line option with a new value. Implemented in csCommandLineParser.

Parameters:
iName -
iValue -
iIndex -
Returns:

reset

public void reset()
Clear all options and names. Implemented in csCommandLineParser