|
TRF Language Model
|
Get the option from command line or command files. More...
#include <wb-option.h>
Public Member Functions | |
| Option () | |
| constructor More... | |
| ~Option () | |
| destructor More... | |
| void | Add (ValueType t, const char *pLabel, void *pAddress, const char *pDocMsg=NULL) |
| Add a option. More... | |
| void | PrintUsage () |
| output usage More... | |
| void | Print (ValueType type, void *pAddress) |
| output a value More... | |
| void | PrintValue () |
| output values More... | |
| void | Parse (const char *plabel, const char *pvalue) |
| parse a single option, "pvalue" can be NULL More... | |
| int | Parse (int argc, char **argv) |
| get the options from command line More... | |
| int | Parse (const char *optfile) |
Public Attributes | |
| Array< Opt_Struct > | m_opts |
| all the options More... | |
| string | m_strOtherHelp |
| extra help information, which will be output in PrintUsage More... | |
| bool | m_bOutputValues |
| if output value after get options from the command line or file More... | |
| bool | m_bMustCommand |
| setting 'true' means that, report error when no option input. More... | |
| Array< char * > | m_allocedBufs |
| if read from file, we may need to allocate memory for string. More... | |
Get the option from command line or command files.
Definition at line 54 of file wb-option.h.
| wb::Option::Option | ( | ) |
constructor
Definition at line 22 of file wb-option.cpp.
| wb::Option::~Option | ( | ) |
destructor
Definition at line 28 of file wb-option.cpp.
| void wb::Option::Add | ( | ValueType | t, |
| const char * | pLabel, | ||
| void * | pAddress, | ||
| const char * | pDocMsg = NULL |
||
| ) |
Add a option.
Definition at line 35 of file wb-option.cpp.
| void wb::Option::Parse | ( | const char * | plabel, |
| const char * | pvalue | ||
| ) |
parse a single option, "pvalue" can be NULL
Definition at line 80 of file wb-option.cpp.
| int wb::Option::Parse | ( | int | argc, |
| char ** | argv | ||
| ) |
get the options from command line
| [in] | argc | command line count |
| [in] | argv | command line strings |
| [in] | pOtherHelp | if parse fails, output the help information |
| [in] | bOutValue | if set true, then output the values |
| [in] | bMustCommand | if set true, then report error when there are on command inputs |
Definition at line 146 of file wb-option.cpp.
| int wb::Option::Parse | ( | const char * | optfile | ) |
| [in] | optfile | the option file name |
| [in] | pOtherHelp | if parse fails, output the help information |
| [in] | bOutValue | if set true, then output the values |
| [in] | bMustCommand | if set true, then report error when there are on command inputs |
Definition at line 186 of file wb-option.cpp.
| void wb::Option::Print | ( | ValueType | type, |
| void * | pAddress | ||
| ) |
output a value
Definition at line 50 of file wb-option.cpp.
| void wb::Option::PrintUsage | ( | ) |
output usage
Definition at line 39 of file wb-option.cpp.
| void wb::Option::PrintValue | ( | ) |
output values
Definition at line 71 of file wb-option.cpp.
| Array<char*> wb::Option::m_allocedBufs |
if read from file, we may need to allocate memory for string.
Definition at line 62 of file wb-option.h.
| bool wb::Option::m_bMustCommand |
setting 'true' means that, report error when no option input.
Definition at line 60 of file wb-option.h.
| bool wb::Option::m_bOutputValues |
if output value after get options from the command line or file
Definition at line 59 of file wb-option.h.
| Array<Opt_Struct> wb::Option::m_opts |
all the options
Definition at line 57 of file wb-option.h.
| string wb::Option::m_strOtherHelp |
extra help information, which will be output in PrintUsage
Definition at line 58 of file wb-option.h.