34 #ifndef PTLIB_ARGLIST_H 35 #define PTLIB_ARGLIST_H 63 const char * theArgPtr = NULL,
64 const char * argumentSpecPtr = NULL,
70 const char * argumentSpecPtr = NULL,
76 const PString & argumentSpecStr,
83 const char * argumentSpecPtr = NULL,
90 const PString & argumentSpecStr,
151 const char * theArgumentSpec,
156 const PString & theArgumentStr,
173 const char * optionStr
190 const char * optionStr
207 const char * dflt = NULL
211 const char * optionStr,
212 const char * dflt = NULL
217 const char * dflt = NULL
235 PINDEX last = P_MAX_INDEX
322 PBoolean ParseOption(PINDEX idx, PINDEX offset, PINDEX & arg,
const PIntArray & canHaveOptionString);
323 PINDEX GetOptionCountByIndex(PINDEX idx)
const;
324 PString GetOptionStringByIndex(PINDEX idx,
const char * dflt)
const;
357 const char * optionStr
374 const char * dflt = NULL
379 const char * optionStr,
380 const char * dflt = NULL
386 const char * dflt = NULL
406 ) { sectionName = section; }
417 ) { negationPrefix = prefix; }
427 PString CharToString(
char ch)
const;
433 #endif // P_CONFIG_FILE 436 #endif // PTLIB_ARGLIST_H PIntArray parameterIndex
The index of each .
Definition: args.h:317
void SetArgs(const PString &theArgStr)
Set the internal copy of the program arguments.
virtual void PrintOn(ostream &strm) const
Output the string to the specified stream.
const PString & GetSectionName() const
Get the PConfig section name for options.
Definition: args.h:410
PStringArray optionString
The array of associated strings to options.
Definition: args.h:315
PINDEX GetCount() const
Get the argument count.
int shift
Shift count for the parameters in the argument list.
Definition: args.h:319
PArgList(const char *theArgPtr=NULL, const char *argumentSpecPtr=NULL, PBoolean optionsBeforeParams=true)
Create an argument list.
#define PCLASSINFO(cls, par)
Declare all the standard PTLib class information.
Definition: object.h:1049
PArgList & operator>>(int sh)
Shift the parameters by the specified amount.
A class representing a configuration for the application.
Definition: config.h:67
PString negationPrefix
Definition: args.h:430
PArgList & operator<<(int sh)
Shift the parameters by the specified amount.
This is an array collection class of PString objects.
Definition: pstring.h:2024
void SetSectionName(const PString §ion)
Set the PConfig section name for options.
Definition: args.h:404
BOOL PBoolean
Definition: object.h:102
void SetNegationPrefix(const PString &prefix)
Set the prefix for option negation.
Definition: args.h:415
PString optionLetters
The specification letters for options.
Definition: args.h:309
virtual PString GetOptionString(char optionChar, const char *dflt=NULL) const
Get option string.
PStringArray optionNames
The specification strings for options.
Definition: args.h:311
virtual PBoolean Parse(const char *theArgumentSpec, PBoolean optionsBeforeParams=true)
Parse the arguments.
PBoolean HasOption(char optionChar) const
Get if option present.
This class parse command line arguments with the ability to override them from a PConfig file/registr...
Definition: args.h:334
virtual void ReadFrom(istream &strm)
Input the string from the specified stream.
The character string class.
Definition: pstring.h:108
This class allows the parsing of a set of program arguments.
Definition: args.h:45
const PString & GetNegationPrefix() const
Get the prefix for option negation.
Definition: args.h:422
PIntArray optionCount
The count of the number of times an option appeared in the command line.
Definition: args.h:313
PStringArray argumentArray
The original program arguments.
Definition: args.h:307
PString GetParameter(PINDEX num) const
Get the parameter that was parsed in the argument list.
virtual void IllegalArgumentIndex(PINDEX idx) const
This function is called when access to illegal parameter index is made in the GetParameter function...
virtual void UnknownOption(const PString &option) const
This function is called when an unknown option was specified on the command line. ...
PString operator[](PINDEX num) const
Get the parameter that was parsed in the argument list.
PConfig config
Definition: args.h:428
PString sectionName
Definition: args.h:429
virtual PINDEX GetOptionCount(char optionChar) const
Get the count of the number of times the option was specified on the command line.
virtual void MissingArgument(const PString &option) const
This function is called when an option that requires an associated string was specified on the comman...
Array of integers.
Definition: array.h:616
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
PStringArray GetParameters(PINDEX first=0, PINDEX last=P_MAX_INDEX) const
Get the parameters that were parsed in the argument list.
void Shift(int sh)
Shift the parameters by the specified amount.