crystalspace.jbind.impl.csutil.cmdline
Class csCommandLineParser

java.lang.Object
  extended bycrystalspace.jbind.impl.csNativeObject
      extended bycrystalspace.jbind.impl.csutil.scf.csBase
          extended bycrystalspace.jbind.impl.csutil.cmdline.csCommandLineParser
All Implemented Interfaces:
iBase, iCommandLineParser, iPointer

public class csCommandLineParser
extends csBase
implements iCommandLineParser

Author:
Quentin Anciaux

Field Summary
 
Fields inherited from class crystalspace.jbind.impl.csNativeObject
ImplFactory, nPointer
 
Constructor Summary
csCommandLineParser(iPointer nPointer)
           
 
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.
static java.lang.Class getInterfaceClass()
           
static java.lang.String getInterfaceName()
           
static int getInterfaceVersion()
           
 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.
 int getVersion()
          Return the version of the interface
 void initialize(java.lang.String[] argv)
          Initialize for the given command line.
static void initSCF()
           
protected  boolean isNativePointerValidSafe(long pointer)
           
 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 class crystalspace.jbind.impl.csutil.scf.csBase
decRef, equals, finalize, getRefCount, incRef, nDelete, queryInterface, queryInterfaceSafe
 
Methods inherited from class crystalspace.jbind.impl.csNativeObject
changePointer, getPointer, getPointer, getPointerArray, hashCode, isMemoryOwner, isNativePointerValid, newNativeObject, setMemoryOwner, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface crystalspace.jbind.interfaces.iutil.scf.iBase
decRef, getRefCount, incRef, queryInterface, queryInterfaceSafe
 
Methods inherited from interface crystalspace.jbind.interfaces.iPointer
changePointer, getPointer, isMemoryOwner, setMemoryOwner
 

Constructor Detail

csCommandLineParser

public csCommandLineParser(iPointer nPointer)
Parameters:
nPointer -
Method Detail

getVersion

public int getVersion()
Description copied from interface: iBase
Return the version of the interface

Specified by:
getVersion in interface iBase
Specified by:
getVersion in class csBase

getName

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

Specified by:
getName in interface iCommandLineParser
Specified by:
getName in class csBase

initSCF

public static void initSCF()

getInterfaceVersion

public static int getInterfaceVersion()

getInterfaceName

public static java.lang.String getInterfaceName()

getInterfaceClass

public static java.lang.Class getInterfaceClass()

isNativePointerValidSafe

protected boolean isNativePointerValidSafe(long pointer)
Specified by:
isNativePointerValidSafe in class csNativeObject

addName

public void addName(java.lang.String iName)
Description copied from interface: iCommandLineParser
Add a command-line name to the command-line names array. Implemented in csCommandLineParser.

Specified by:
addName in interface iCommandLineParser
Parameters:
iName -
See Also:
iCommandLineParser.addName(java.lang.String)

addOption

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

Specified by:
addOption in interface iCommandLineParser
Parameters:
iName -
iValue -
See Also:
iCommandLineParser.addOption(java.lang.String, java.lang.String)

getAppDir

public java.lang.String getAppDir()
Description copied from interface: iCommandLineParser
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.

Specified by:
getAppDir in interface iCommandLineParser
Returns:
See Also:
iCommandLineParser.getAppDir()

getAppPath

public java.lang.String getAppPath()
Description copied from interface: iCommandLineParser
Returns the full path to the application executable. Implemented in csCommandLineParser.

Specified by:
getAppPath in interface iCommandLineParser
Returns:
See Also:
iCommandLineParser.getAppPath()

getBoolOption

public boolean getBoolOption(java.lang.String iName,
                             boolean defaultValue)
Description copied from interface: iCommandLineParser
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.

Specified by:
getBoolOption in interface iCommandLineParser
Parameters:
iName -
defaultValue -
Returns:
See Also:
iCommandLineParser.getBoolOption(java.lang.String, boolean)

getBoolOption

public boolean getBoolOption(java.lang.String iName)
Description copied from interface: iCommandLineParser
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.

Specified by:
getBoolOption in interface iCommandLineParser
Parameters:
iName -
Returns:
See Also:
iCommandLineParser.getBoolOption(java.lang.String)

getName

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

Specified by:
getName in interface iCommandLineParser
Parameters:
iIndex -
Returns:
See Also:
iCommandLineParser.getName(int)

getOption

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

Specified by:
getOption in interface iCommandLineParser
Parameters:
iName -
iIndex -
Returns:
See Also:
iCommandLineParser.getOption(java.lang.String, int)

getOption

public java.lang.String getOption(java.lang.String iName)
Description copied from interface: iCommandLineParser
Query specific commandline option (you can query second etc. such option);. Implemented in csCommandLineParser.

Specified by:
getOption in interface iCommandLineParser
Parameters:
iName -
Returns:
See Also:
iCommandLineParser.getOption(java.lang.String)

getResourceDir

public java.lang.String getResourceDir()
Description copied from interface: iCommandLineParser
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.

Specified by:
getResourceDir in interface iCommandLineParser
Returns:
See Also:
iCommandLineParser.getResourceDir()

initialize

public void initialize(java.lang.String[] argv)
Description copied from interface: iCommandLineParser
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.

Specified by:
initialize in interface iCommandLineParser
Parameters:
argv -
See Also:
iCommandLineParser.initialize(java.lang.String[])

replaceName

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

Specified by:
replaceName in interface iCommandLineParser
Parameters:
iValue -
iIndex -
Returns:
See Also:
iCommandLineParser.replaceName(java.lang.String, int)

replaceName

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

Specified by:
replaceName in interface iCommandLineParser
Parameters:
iValue -
Returns:
See Also:
iCommandLineParser.replaceName(java.lang.String)

replaceOption

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

Specified by:
replaceOption in interface iCommandLineParser
Parameters:
iName -
iValue -
iIndex -
Returns:
See Also:
iCommandLineParser.replaceOption(java.lang.String, java.lang.String, int)

replaceOption

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

Specified by:
replaceOption in interface iCommandLineParser
Parameters:
iName -
iValue -
Returns:
See Also:
iCommandLineParser.replaceOption(java.lang.String, java.lang.String)

reset

public void reset()
Description copied from interface: iCommandLineParser
Clear all options and names. Implemented in csCommandLineParser

Specified by:
reset in interface iCommandLineParser
See Also:
iCommandLineParser.reset()