Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

PArgList Class Reference

#include <args.h>

Inheritance diagram for PArgList:


List of all members.

Detailed Description

This class allows the parsing of a set of program arguments. This translates the standard argc/argv style variables passed into the main() function into a set of options (preceded by a '-' character) and parameters.

Definition at line 132 of file args.h.

Comparison functions

virtual Comparison Compare (const PObject &obj) const
virtual Comparison CompareObjectMemoryDirect (const PObject &obj) const
bool operator!= (const PObject &obj) const
bool operator< (const PObject &obj) const
bool operator<= (const PObject &obj) const
bool operator== (const PObject &obj) const
bool operator> (const PObject &obj) const
bool operator>= (const PObject &obj) const
enum  Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 }

Run Time Type functions

virtual const char * GetClass (unsigned=0) const
virtual BOOL InternalIsDescendant (const char *clsName) const
BOOL IsClass (const char *cls) const
static const char * Class ()

Public Member Functions

Miscellaneous functions
virtual PObjectClone () const
virtual PINDEX HashFunction () const
Getting parsed arguments
PINDEX GetCount () const
virtual PINDEX GetOptionCount (const PString &optionName) const
virtual PINDEX GetOptionCount (const char *optionStr) const
virtual PINDEX GetOptionCount (char optionChar) const
virtual PString GetOptionString (const PString &optionName, const char *dflt=NULL) const
virtual PString GetOptionString (const char *optionStr, const char *dflt=NULL) const
virtual PString GetOptionString (char optionChar, const char *dflt=NULL) const
PString GetParameter (PINDEX num) const
PStringArray GetParameters (PINDEX first=0, PINDEX last=P_MAX_INDEX) const
BOOL HasOption (const PString &optionName) const
BOOL HasOption (const char *optionStr) const
BOOL HasOption (char optionChar) const
PArgListoperator<< (int sh)
PArgListoperator>> (int sh)
PString operator[] (PINDEX num) const
void Shift (int sh)
virtual void IllegalArgumentIndex (PINDEX idx) const
virtual void MissingArgument (const PString &option) const
virtual void UnknownOption (const PString &option) const
 PArgList (int theArgc, char **theArgv, const PString &argumentSpecStr, BOOL optionsBeforeParams=TRUE)
 PArgList (int theArgc, char **theArgv, const char *argumentSpecPtr=NULL, BOOL optionsBeforeParams=TRUE)
 PArgList (const PString &theArgStr, const PString &argumentSpecStr, BOOL optionsBeforeParams=TRUE)
 PArgList (const PString &theArgStr, const char *argumentSpecPtr=NULL, BOOL optionsBeforeParams=TRUE)
 PArgList (const char *theArgPtr=NULL, const char *argumentSpecPtr=NULL, BOOL optionsBeforeParams=TRUE)
Setting & Parsing
virtual BOOL Parse (const PString &theArgumentStr, BOOL optionsBeforeParams=TRUE)
virtual BOOL Parse (const char *theArgumentSpec, BOOL optionsBeforeParams=TRUE)
void SetArgs (const PStringArray &theArgs)
void SetArgs (int theArgc, char **theArgv)
void SetArgs (const PString &theArgStr)
Overrides from class PObject
virtual void PrintOn (ostream &strm) const
virtual void ReadFrom (istream &strm)

Protected Attributes

PStringArray argumentArray
 The original program arguments.
PIntArray optionCount
 The count of the number of times an option appeared in the command line.
PString optionLetters
 The specification letters for options.
PStringArray optionNames
 The specification strings for options.
PStringArray optionString
 The array of associated strings to options.
PIntArray parameterIndex
 The index of each .
int shift
 Shift count for the parameters in the argument list.

Private Member Functions

PINDEX GetOptionCountByIndex (PINDEX idx) const
PString GetOptionStringByIndex (PINDEX idx, const char *dflt) const
BOOL ParseOption (PINDEX idx, PINDEX offset, PINDEX &arg, const PIntArray &canHaveOptionString)
 PCLASSINFO (PArgList, PObject)


I/O functions
ostream & operator<< (ostream &strm, const PObject &obj)
istream & operator>> (istream &strm, PObject &obj)

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index