PTLib
Version 2.10.4
|
This class parse command line arguments with the ability to override them from a PConfig file/registry. More...
#include <args.h>
Public Member Functions | |
Construction | |
PConfigArgs (const PArgList &args) | |
Overrides from class PArgList | |
virtual PINDEX | GetOptionCount (char optionChar) const |
Get the count of the number of times the option was specified on the command line. | |
virtual PINDEX | GetOptionCount (const char *optionStr) const |
Get the count of option. | |
virtual PINDEX | GetOptionCount (const PString &optionName) const |
Get the count of option. | |
virtual PString | GetOptionString (char optionChar, const char *dflt=NULL) const |
Get option string. | |
virtual PString | GetOptionString (const char *optionStr, const char *dflt=NULL) const |
Get option string. | |
virtual PString | GetOptionString (const PString &optionName, const char *dflt=NULL) const |
Get option string. | |
void | Save (const PString &optionName) |
Save the current options to the PConfig. | |
void | SetSectionName (const PString §ion) |
Set the PConfig section name for options. | |
const PString & | GetSectionName () const |
Get the PConfig section name for options. | |
void | SetNegationPrefix (const PString &prefix) |
Set the prefix for option negation. | |
const PString & | GetNegationPrefix () const |
Get the prefix for option negation. | |
Protected Member Functions | |
PString | CharToString (char ch) const |
Protected Attributes | |
PConfig | config |
PString | sectionName |
PString | negationPrefix |
This class parse command line arguments with the ability to override them from a PConfig file/registry.
PConfigArgs::PConfigArgs | ( | const PArgList & | args | ) |
args | Raw argument list. |
PString PConfigArgs::CharToString | ( | char | ch | ) | const [protected] |
const PString& PConfigArgs::GetNegationPrefix | ( | ) | const [inline] |
virtual PINDEX PConfigArgs::GetOptionCount | ( | char | optionChar | ) | const [virtual] |
Get the count of the number of times the option was specified on the command line.
optionChar | Character letter code for the option |
Reimplemented from PArgList.
virtual PINDEX PConfigArgs::GetOptionCount | ( | const char * | optionStr | ) | const [virtual] |
Get the count of option.
optionStr | String code for the option |
Reimplemented from PArgList.
virtual PINDEX PConfigArgs::GetOptionCount | ( | const PString & | optionName | ) | const [virtual] |
Get the count of option.
optionName | String code for the option |
Reimplemented from PArgList.
virtual PString PConfigArgs::GetOptionString | ( | char | optionChar, |
const char * | dflt = NULL |
||
) | const [virtual] |
Get option string.
Gets the string associated with an option e.g. -ofile or -o file would return the string "file". An option may have an associated string if it had a ':' character folowing it in the specification string passed to the Parse() function.
optionChar | Character letter code for the option |
dflt | Default value of the option string |
Reimplemented from PArgList.
virtual PString PConfigArgs::GetOptionString | ( | const char * | optionStr, |
const char * | dflt = NULL |
||
) | const [virtual] |
Get option string.
optionStr | String letter code for the option |
dflt | Default value of the option string |
Reimplemented from PArgList.
virtual PString PConfigArgs::GetOptionString | ( | const PString & | optionName, |
const char * | dflt = NULL |
||
) | const [virtual] |
Get option string.
optionName | String code for the option |
dflt | Default value of the option string |
Reimplemented from PArgList.
const PString& PConfigArgs::GetSectionName | ( | ) | const [inline] |
Get the PConfig section name for options.
References sectionName.
void PConfigArgs::Save | ( | const PString & | optionName | ) |
Save the current options to the PConfig.
This function will check to see if the option name is present and if so, save to the PConfig all of the arguments present in the currently parsed list. Note that the optionName for saving is not saved to the PConfig itself as this would cause the data to be saved always!
optionName | Option name for saving. |
void PConfigArgs::SetNegationPrefix | ( | const PString & | prefix | ) | [inline] |
Set the prefix for option negation.
The default is "no-".
prefix | New prefix string |
References negationPrefix.
void PConfigArgs::SetSectionName | ( | const PString & | section | ) | [inline] |
Set the PConfig section name for options.
section | New section name |
References sectionName.
PConfig PConfigArgs::config [protected] |
PString PConfigArgs::negationPrefix [protected] |
Referenced by GetNegationPrefix(), and SetNegationPrefix().
PString PConfigArgs::sectionName [protected] |
Referenced by GetSectionName(), and SetSectionName().