#include <ProgramOptions.h>
Public Types | |
| typedef std::vector< ProgramOption * >::const_iterator | const_option_iterator |
| typedef std::vector< std::string >::const_iterator | const_parameter_iterator |
Public Member Functions | |
| ProgramOptions () | |
| ~ProgramOptions () | |
| void | AddBoolean (char cShortOption, const char *pszLongOption=0, bool bDefault=false, bool bCaseSensitive=false, const char *pszHelpText=0) |
| Adds a boolean option with no parameter. | |
| void | AddString (char cShortOption, const char *pszLongOption=0, const char *pszDefault=0, bool bCaseSensitive=false, const char *pszParameterHint=0, const char *pszHelpText=0) |
| Adds a string option with parameter. | |
| void | AddLong (char cShortOption, const char *pszLongOption=0, long lDefault=0, long lMin=LONG_MIN, long lMax=LONG_MAX, bool bCaseSensitive=false, const char *pszParameterHint=0, const char *pszHelpText=0) |
| Adds a long option with parameter within min and max. | |
| void | PrintHelp (std::ostream &os, int width=79) const |
| Outputs help text to stream. | |
| bool | IsOptionChar (char c) const |
| Returns true if character is an option character of one of the contained ProgramOption objects. | |
| ProgramOption * | GetOption (char c) const |
| Returns option if character is an option or 0. | |
| ProgramOption * | GetOption (const char *psz) const |
| Returns option if string is an option or 0. | |
| bool | Parse (int argc, char *argv[], std::locale loc=std::locale::classic()) |
| Parses arguments according to added options. | |
| const_option_iterator | options_begin () const |
| const_option_iterator | options_end () const |
| const_parameter_iterator | parameter_begin () const |
| const_parameter_iterator | parameter_end () const |
| bool | GetBoolValue (char option) const |
| bool | GetBoolValue (const char *pszOption) const |
| long | GetLongValue (char option) const |
| long | GetLongValue (const char *pszOption) const |
| std::string | GetStringValue (char option) const |
| std::string | GetStringValue (const char *pszOption) const |
Protected Types | |
| typedef std::vector< ProgramOption * >::iterator | option_iterator |
Protected Member Functions | |
| void | Add (ProgramOption *pOption) |
| void | AddParameter (const char *psz) |
| std::string | GetStringParameter (const char *psz) const |
| Returns string parameter within quotes removed if present. | |
Protected Attributes | |
| std::vector< ProgramOption * > | m_options |
| std::vector< std::string > | m_parameters |
| std::string | m_sOptionChars |
Friends | |
| std::ostream & | operator<< (std::ostream &, const ProgramOptions &) |
Definition at line 113 of file ProgramOptions.h.
|
|
Definition at line 152 of file ProgramOptions.h. |
|
|
Definition at line 155 of file ProgramOptions.h. |
|
|
Definition at line 165 of file ProgramOptions.h. |
|
|
Definition at line 38 of file ProgramOptions.cpp. References m_sOptionChars. |
|
|
Definition at line 43 of file ProgramOptions.cpp. References m_options. |
|
|
Definition at line 133 of file ProgramOptions.cpp. References m_options. Referenced by AddBoolean(), AddLong(), and AddString(). |
|
||||||||||||||||||||||||
|
Adds a boolean option with no parameter.
Definition at line 50 of file ProgramOptions.cpp. References Add(), ProgramOption::m_bCaseSensitive, ProgramOption::m_bValue, ProgramOption::m_sHelpText, ProgramOption::opt_boolean, and safe_assign(). Referenced by main(). Here is the call graph for this function: ![]() |
|
||||||||||||||||||||||||||||||||||||
|
Adds a long option with parameter within min and max.
Definition at line 86 of file ProgramOptions.cpp. References Add(), ProgramOption::m_bCaseSensitive, ProgramOption::m_lMaxValue, ProgramOption::m_lMinValue, ProgramOption::m_lValue, ProgramOption::m_sHelpText, ProgramOption::m_sParameterHint, ProgramOption::opt_long, and safe_assign(). Referenced by main(). Here is the call graph for this function: ![]() |
|
|
Definition at line 138 of file ProgramOptions.cpp. References m_parameters, and safe_assign(). Referenced by Parse(). Here is the call graph for this function: ![]() |
|
||||||||||||||||||||||||||||
|
Adds a string option with parameter.
Definition at line 67 of file ProgramOptions.cpp. References Add(), ProgramOption::m_bCaseSensitive, ProgramOption::m_sHelpText, ProgramOption::m_sParameterHint, ProgramOption::m_sValue, ProgramOption::opt_string, and safe_assign(). Referenced by main(). Here is the call graph for this function: ![]() |
|
|
Definition at line 294 of file ProgramOptions.cpp. References ProgramOption::GetBoolValue(), and GetOption(). Here is the call graph for this function: ![]() |
|
|
Definition at line 285 of file ProgramOptions.cpp. References ProgramOption::GetBoolValue(), and GetOption(). Referenced by main(). Here is the call graph for this function: ![]() |
|
|
Definition at line 312 of file ProgramOptions.cpp. References ProgramOption::GetLongValue(), and GetOption(). Here is the call graph for this function: ![]() |
|
|
Definition at line 303 of file ProgramOptions.cpp. References ProgramOption::GetLongValue(), and GetOption(). Referenced by main(). Here is the call graph for this function: ![]() |
|
|
Returns option if string is an option or 0.
Definition at line 161 of file ProgramOptions.cpp. References ProgramOption::IsOption(), options_begin(), and options_end(). Here is the call graph for this function: ![]() |
|
|
Returns option if character is an option or 0.
Definition at line 150 of file ProgramOptions.cpp. References ProgramOption::IsOption(), options_begin(), and options_end(). Referenced by GetBoolValue(), GetLongValue(), GetStringValue(), and Parse(). Here is the call graph for this function: ![]() |
|
|
Returns string parameter within quotes removed if present.
Definition at line 172 of file ProgramOptions.cpp. References safe_assign(). Referenced by Parse(). Here is the call graph for this function: ![]() |
|
|
Definition at line 330 of file ProgramOptions.cpp. References GetOption(), and ProgramOption::GetStringValue(). Here is the call graph for this function: ![]() |
|
|
Definition at line 321 of file ProgramOptions.cpp. References GetOption(), and ProgramOption::GetStringValue(). Referenced by main(). Here is the call graph for this function: ![]() |
|
|
Returns true if character is an option character of one of the contained ProgramOption objects.
Definition at line 145 of file ProgramOptions.cpp. References m_sOptionChars. Referenced by Parse(). |
|
|
Definition at line 153 of file ProgramOptions.h. References m_options. Referenced by GetOption(), operator<<(), and PrintHelp(). |
|
|
Definition at line 154 of file ProgramOptions.h. References m_options. Referenced by GetOption(), operator<<(), and PrintHelp(). |
|
|
Definition at line 156 of file ProgramOptions.h. References m_parameters. Referenced by main(), and operator<<(). |
|
|
Definition at line 157 of file ProgramOptions.h. References m_parameters. Referenced by main(), and operator<<(). |
|
||||||||||||||||
|
Parses arguments according to added options. Returns true if no errors occurred. Definition at line 191 of file ProgramOptions.cpp. References AddParameter(), GetOption(), GetStringParameter(), ProgramOption::GetType(), ProgramOption::HasParameter(), IsOptionChar(), ProgramOption::opt_long, ProgramOption::opt_string, ProgramOption::SetBoolValue(), ProgramOption::SetLongValue(), and ProgramOption::SetStringValue(). Referenced by main(). Here is the call graph for this function: ![]() |
|
||||||||||||
|
Outputs help text to stream.
Definition at line 108 of file ProgramOptions.cpp. References ProgramOption::GetHelpText(), ProgramOption::GetLongOption(), ProgramOption::GetParameterHint(), ProgramOption::GetShortOption(), ProgramOption::HasLongOption(), ProgramOption::HasParameter(), ProgramOption::HasShortOption(), m_sOptionChars, options_begin(), and options_end(). Referenced by main(). Here is the call graph for this function: ![]() |
|
||||||||||||
|
Definition at line 339 of file ProgramOptions.cpp. |
|
|
Definition at line 167 of file ProgramOptions.h. Referenced by Add(), options_begin(), options_end(), and ~ProgramOptions(). |
|
|
Definition at line 169 of file ProgramOptions.h. Referenced by AddParameter(), operator<<(), parameter_begin(), and parameter_end(). |
|
|
Definition at line 171 of file ProgramOptions.h. Referenced by IsOptionChar(), PrintHelp(), and ProgramOptions(). |
1.4.3