Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

vuCommandLineTool Class Reference

#include <vuCommandLineTool.h>

Collaboration diagram for vuCommandLineTool:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 vuCommandLineTool ()
 vuCommandLineTool (int argc, const char **argv)
 vuCommandLineTool (const vuCommandLineTool &other)
 ~vuCommandLineTool ()
bool hasParameter (const char *param)
vuString stringForParameter (const char *param)
 returns the string value for a param
float floatForParameter (const char *param)
 returns the float value for a param
int intForParameter (const char *param)
 returns the int value for a param
word numberOfNonParameters ()
word numberOfNonParameters (bool &isValid)
vuString getNonParameter (const dword idx)
vuString getArgument (word i)
 get the ith argument of the command line
bool fileExists (const vuString &fileName)
 returns true if file exists, otherwise false
vuString toolName ()

Private Member Functions

int indexForParamter (const vuString &param)

Private Attributes

int m_argc
vuStringm_argv

Detailed Description

This class offers command line parameter parsing.

Following three schemes are supported: -t --type --type=someValue

Definition at line 11 of file vuCommandLineTool.h.


Constructor & Destructor Documentation

vuCommandLineTool::vuCommandLineTool  ) 
 

Definition at line 5 of file vuCommandLineTool.cpp.

References m_argc, and m_argv.

vuCommandLineTool::vuCommandLineTool int  argc,
const char **  argv
 

Definition at line 11 of file vuCommandLineTool.cpp.

References m_argc, and m_argv.

vuCommandLineTool::vuCommandLineTool const vuCommandLineTool other  ) 
 

Definition at line 23 of file vuCommandLineTool.cpp.

vuCommandLineTool::~vuCommandLineTool  ) 
 

Definition at line 28 of file vuCommandLineTool.cpp.

References m_argv.


Member Function Documentation

bool vuCommandLineTool::fileExists const vuString fileName  ) 
 

returns true if file exists, otherwise false

Definition at line 126 of file vuCommandLineTool.cpp.

References vuString::c_str().

Referenced by _parseParameters().

Here is the call graph for this function:

float vuCommandLineTool::floatForParameter const char *  param  ) 
 

returns the float value for a param

Definition at line 64 of file vuCommandLineTool.cpp.

References vuString::c_str(), and stringForParameter().

Referenced by _parseParameters().

Here is the call graph for this function:

vuString vuCommandLineTool::getArgument word  i  ) 
 

get the ith argument of the command line

Definition at line 119 of file vuCommandLineTool.cpp.

References m_argc, m_argv, and word.

Referenced by _parseParameters(), and getNonParameter().

vuString vuCommandLineTool::getNonParameter const dword  idx  ) 
 

Definition at line 111 of file vuCommandLineTool.cpp.

References dword, getArgument(), m_argc, and numberOfNonParameters().

Here is the call graph for this function:

bool vuCommandLineTool::hasParameter const char *  param  ) 
 

returns true, if param exists, otherwise false

Note:
Example: hasPrameter("-t"), or hasParameter("--type")

Definition at line 36 of file vuCommandLineTool.cpp.

References indexForParamter().

Referenced by _parseParameters().

Here is the call graph for this function:

int vuCommandLineTool::indexForParamter const vuString param  )  [private]
 

Definition at line 154 of file vuCommandLineTool.cpp.

References vuString::hasPrefix(), vuString::isEmpty(), and m_argv.

Referenced by hasParameter(), and stringForParameter().

Here is the call graph for this function:

int vuCommandLineTool::intForParameter const char *  param  ) 
 

returns the int value for a param

Definition at line 74 of file vuCommandLineTool.cpp.

References vuString::c_str(), and stringForParameter().

Referenced by _parseParameters().

Here is the call graph for this function:

word vuCommandLineTool::numberOfNonParameters bool isValid  ) 
 

returns the number of non parameters (the ones which don't have the prefix '-') AT THE END of argv.

Note:
A "non parameter" between normal parameters will be ignored and is considered to be not valid. The parameter isValid tracks this information.

Definition at line 91 of file vuCommandLineTool.cpp.

References vuString::hasPrefix(), m_argc, m_argv, and word.

Here is the call graph for this function:

word vuCommandLineTool::numberOfNonParameters  ) 
 

returns the number of non parameters (the ones which don't have the prefix '-') AT THE END of argv.

Note:
A "non parameter" between normal parameters will be ignored and is considered to be not valid.

Definition at line 85 of file vuCommandLineTool.cpp.

References word.

Referenced by _parseParameters(), and getNonParameter().

vuString vuCommandLineTool::stringForParameter const char *  param  ) 
 

returns the string value for a param

Definition at line 41 of file vuCommandLineTool.cpp.

References dword, vuString::getLength(), vuString::hasPrefix(), indexForParamter(), m_argv, and vuString::substr().

Referenced by _parseParameters(), floatForParameter(), and intForParameter().

Here is the call graph for this function:

vuString vuCommandLineTool::toolName  ) 
 

returns the lastPathComponent of the 0th argument of argv (usually the toolname)

Definition at line 144 of file vuCommandLineTool.cpp.

References vuString::getLastPathComponent(), m_argc, and m_argv.

Referenced by _helpString(), and _parseParameters().

Here is the call graph for this function:


Member Data Documentation

int vuCommandLineTool::m_argc [private]
 

Definition at line 65 of file vuCommandLineTool.h.

Referenced by getArgument(), getNonParameter(), numberOfNonParameters(), toolName(), and vuCommandLineTool().

vuString* vuCommandLineTool::m_argv [private]
 

Definition at line 66 of file vuCommandLineTool.h.

Referenced by getArgument(), indexForParamter(), numberOfNonParameters(), stringForParameter(), toolName(), vuCommandLineTool(), and ~vuCommandLineTool().


The documentation for this class was generated from the following files:
Generated on Wed Dec 15 21:21:14 2004 for vuVolume by  doxygen 1.3.9.1