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

Protected Attributes | Private Member Functions

PArgList Class Reference

#include <args.h>

Inheritance diagram for PArgList:
Inheritance graph
Collaboration diagram for PArgList:
Collaboration graph

List of all members.

Public Member Functions

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

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)

Run Time Type functions

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

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 }

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.

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

Generated by  Doxygen 1.6.0   Back to index