AnyOption Class Reference

#include <anyoption.h>

List of all members.

Public Member Functions

 AnyOption ()
 AnyOption (int maxoptions)
 AnyOption (int maxoptions, int maxcharoptions)
 ~AnyOption ()
void setCommandPrefixChar (char _prefix)
void setCommandLongPrefix (char *_prefix)
void setFileCommentChar (char _comment)
void setFileDelimiterChar (char _delimiter)
void useCommandArgs (int _argc, char **_argv)
void useFiileName (const char *_filename)
void noPOSIX ()
void setVerbose ()
void setOption (const char *opt_string)
void setOption (char opt_char)
void setOption (const char *opt_string, char opt_char)
void setFlag (const char *opt_string)
void setFlag (char opt_char)
void setFlag (const char *opt_string, char opt_char)
void setCommandOption (const char *opt_string)
void setCommandOption (char opt_char)
void setCommandOption (const char *opt_string, char opt_char)
void setCommandFlag (const char *opt_string)
void setCommandFlag (char opt_char)
void setCommandFlag (const char *opt_string, char opt_char)
void setFileOption (const char *opt_string)
void setFileOption (char opt_char)
void setFileOption (const char *opt_string, char opt_char)
void setFileFlag (const char *opt_string)
void setFileFlag (char opt_char)
void setFileFlag (const char *opt_string, char opt_char)
void processOptions ()
void processCommandArgs ()
void processCommandArgs (int max_args)
bool processFile ()
void processCommandArgs (int _argc, char **_argv)
void processCommandArgs (int _argc, char **_argv, int max_args)
bool processFile (const char *_filename)
char * getValue (const char *_option)
bool getFlag (const char *_option)
char * getValue (char _optchar)
bool getFlag (char _optchar)
void printUsage ()
void printAutoUsage ()
void addUsage (const char *line)
void printHelp ()
void autoUsagePrint (bool flag)
int getArgc ()
char * getArgv (int index)
bool hasOptions ()

Private Member Functions

void init ()
void init (int maxopt, int maxcharopt)
bool alloc ()
void cleanup ()
bool valueStoreOK ()
bool doubleOptStorage ()
bool doubleCharStorage ()
bool doubleUsageStorage ()
bool setValue (const char *option, char *value)
bool setFlagOn (const char *option)
bool setValue (char optchar, char *value)
bool setFlagOn (char optchar)
void addOption (const char *option, int type)
void addOption (char optchar, int type)
void addOptionError (const char *opt)
void addOptionError (char opt)
bool findFlag (char *value)
void addUsageError (const char *line)
bool CommandSet ()
bool FileSet ()
bool POSIX ()
char parsePOSIX (char *arg)
int parseGNU (char *arg)
bool matchChar (char c)
int matchOpt (char *opt)
char * readFile ()
char * readFile (const char *fname)
bool consumeFile (char *buffer)
void processLine (char *theline, int length)
char * chomp (char *str)
void valuePairs (char *type, char *value)
void justValue (char *value)
void printVerbose (const char *msg)
void printVerbose (char *msg)
void printVerbose (char ch)
void printVerbose ()

Private Attributes

int argc
char ** argv
const char * filename
char * appname
int * new_argv
int new_argc
int max_legal_args
int max_options
const char ** options
int * optiontype
int * optionindex
int option_counter
int max_char_options
char * optionchars
int * optchartype
int * optcharindex
int optchar_counter
char ** values
int g_value_counter
const char ** usage
int max_usage_lines
int usage_lines
bool command_set
bool file_set
bool mem_allocated
bool posix_style
bool verbose
bool print_usage
bool print_help
char opt_prefix_char
char long_opt_prefix [MAX_LONG_PREFIX_LENGTH]
char file_delimiter_char
char file_comment_char
char equalsign
char comment
char delimiter
char endofline
char whitespace
char nullterminate
bool set
bool once
bool hasoptions
bool autousage


Detailed Description

Definition at line 32 of file anyoption.h.


Constructor & Destructor Documentation

AnyOption (  ) 

Definition at line 65 of file anyoption.cpp.

AnyOption ( int  maxoptions  ) 

Definition at line 70 of file anyoption.cpp.

AnyOption ( int  maxoptions,
int  maxcharoptions 
)

Definition at line 75 of file anyoption.cpp.

~AnyOption (  ) 

Definition at line 80 of file anyoption.cpp.


Member Function Documentation

void setCommandPrefixChar ( char  _prefix  ) 

Definition at line 269 of file anyoption.cpp.

void setCommandLongPrefix ( char *  _prefix  ) 

Definition at line 275 of file anyoption.cpp.

void setFileCommentChar ( char  _comment  ) 

Definition at line 285 of file anyoption.cpp.

void setFileDelimiterChar ( char  _delimiter  ) 

Definition at line 292 of file anyoption.cpp.

void useCommandArgs ( int  _argc,
char **  _argv 
)

Definition at line 368 of file anyoption.cpp.

Referenced by processCommandArgs().

Here is the caller graph for this function:

void useFiileName ( const char *  _filename  ) 

Definition at line 378 of file anyoption.cpp.

Referenced by processFile().

Here is the caller graph for this function:

void noPOSIX (  ) 

Definition at line 310 of file anyoption.cpp.

void setVerbose (  ) 

Definition at line 323 of file anyoption.cpp.

void setOption ( const char *  opt_string  ) 

Definition at line 477 of file anyoption.cpp.

Referenced by main().

Here is the caller graph for this function:

void setOption ( char  opt_char  ) 

Definition at line 484 of file anyoption.cpp.

void setOption ( const char *  opt_string,
char  opt_char 
)

Definition at line 491 of file anyoption.cpp.

void setFlag ( const char *  opt_string  ) 

Definition at line 499 of file anyoption.cpp.

Referenced by main().

Here is the caller graph for this function:

void setFlag ( char  opt_char  ) 

Definition at line 506 of file anyoption.cpp.

void setFlag ( const char *  opt_string,
char  opt_char 
)

Definition at line 513 of file anyoption.cpp.

void setCommandOption ( const char *  opt_string  ) 

Definition at line 389 of file anyoption.cpp.

void setCommandOption ( char  opt_char  ) 

Definition at line 396 of file anyoption.cpp.

void setCommandOption ( const char *  opt_string,
char  opt_char 
)

Definition at line 403 of file anyoption.cpp.

void setCommandFlag ( const char *  opt_string  ) 

Definition at line 411 of file anyoption.cpp.

void setCommandFlag ( char  opt_char  ) 

Definition at line 418 of file anyoption.cpp.

void setCommandFlag ( const char *  opt_string,
char  opt_char 
)

Definition at line 425 of file anyoption.cpp.

void setFileOption ( const char *  opt_string  ) 

Definition at line 433 of file anyoption.cpp.

void setFileOption ( char  opt_char  ) 

Definition at line 440 of file anyoption.cpp.

void setFileOption ( const char *  opt_string,
char  opt_char 
)

Definition at line 447 of file anyoption.cpp.

void setFileFlag ( const char *  opt_string  ) 

Definition at line 455 of file anyoption.cpp.

void setFileFlag ( char  opt_char  ) 

Definition at line 462 of file anyoption.cpp.

void setFileFlag ( const char *  opt_string,
char  opt_char 
)

Definition at line 469 of file anyoption.cpp.

void processOptions (  ) 

Definition at line 582 of file anyoption.cpp.

void processCommandArgs (  ) 

Definition at line 610 of file anyoption.cpp.

Referenced by main(), and processCommandArgs().

Here is the caller graph for this function:

void processCommandArgs ( int  max_args  ) 

Definition at line 589 of file anyoption.cpp.

bool processFile (  ) 

Definition at line 922 of file anyoption.cpp.

Referenced by processFile().

Here is the caller graph for this function:

void processCommandArgs ( int  _argc,
char **  _argv 
)

Definition at line 603 of file anyoption.cpp.

void processCommandArgs ( int  _argc,
char **  _argv,
int  max_args 
)

Definition at line 596 of file anyoption.cpp.

bool processFile ( const char *  _filename  ) 

Definition at line 930 of file anyoption.cpp.

char * getValue ( const char *  _option  ) 

Definition at line 780 of file anyoption.cpp.

Referenced by main().

Here is the caller graph for this function:

bool getFlag ( const char *  _option  ) 

Definition at line 793 of file anyoption.cpp.

Referenced by main().

Here is the caller graph for this function:

char * getValue ( char  _optchar  ) 

Definition at line 805 of file anyoption.cpp.

bool getFlag ( char  _optchar  ) 

Definition at line 817 of file anyoption.cpp.

void printUsage (  ) 

Definition at line 1139 of file anyoption.cpp.

Referenced by main(), and printAutoUsage().

Here is the caller graph for this function:

void printAutoUsage (  ) 

Definition at line 1133 of file anyoption.cpp.

Referenced by matchChar(), matchOpt(), parseGNU(), parsePOSIX(), and processCommandArgs().

Here is the caller graph for this function:

void addUsage ( const char *  line  ) 

Definition at line 1153 of file anyoption.cpp.

Referenced by main().

Here is the caller graph for this function:

void printHelp (  ) 

void autoUsagePrint ( bool  flag  ) 

Definition at line 362 of file anyoption.cpp.

int getArgc (  ) 

Definition at line 905 of file anyoption.cpp.

Referenced by main().

Here is the caller graph for this function:

char * getArgv ( int  index  ) 

Definition at line 911 of file anyoption.cpp.

bool hasOptions (  ) 

Definition at line 356 of file anyoption.cpp.

void init (  )  [private]

Definition at line 87 of file anyoption.cpp.

Referenced by AnyOption().

Here is the caller graph for this function:

void init ( int  maxopt,
int  maxcharopt 
) [private]

Definition at line 93 of file anyoption.cpp.

bool alloc (  )  [private]

Definition at line 143 of file anyoption.cpp.

Referenced by init().

Here is the caller graph for this function:

void cleanup (  )  [private]

Definition at line 253 of file anyoption.cpp.

Referenced by ~AnyOption().

Here is the caller graph for this function:

bool valueStoreOK (  )  [private]

Definition at line 761 of file anyoption.cpp.

Referenced by getFlag(), getValue(), processCommandArgs(), processFile(), processOptions(), setFlagOn(), and setValue().

Here is the caller graph for this function:

bool doubleOptStorage (  )  [private]

Definition at line 194 of file anyoption.cpp.

Referenced by addOption().

Here is the caller graph for this function:

bool doubleCharStorage (  )  [private]

Definition at line 215 of file anyoption.cpp.

Referenced by addOption().

Here is the caller graph for this function:

bool doubleUsageStorage (  )  [private]

Definition at line 238 of file anyoption.cpp.

Referenced by addUsage().

Here is the caller graph for this function:

bool setValue ( const char *  option,
char *  value 
) [private]

Definition at line 844 of file anyoption.cpp.

Referenced by parseGNU(), parsePOSIX(), processCommandArgs(), and valuePairs().

Here is the caller graph for this function:

bool setFlagOn ( const char *  option  )  [private]

Definition at line 859 of file anyoption.cpp.

Referenced by justValue(), matchChar(), and matchOpt().

Here is the caller graph for this function:

bool setValue ( char  optchar,
char *  value 
) [private]

Definition at line 874 of file anyoption.cpp.

bool setFlagOn ( char  optchar  )  [private]

Definition at line 889 of file anyoption.cpp.

void addOption ( const char *  option,
int  type 
) [private]

Definition at line 521 of file anyoption.cpp.

Referenced by setCommandFlag(), setCommandOption(), setFileFlag(), setFileOption(), setFlag(), and setOption().

Here is the caller graph for this function:

void addOption ( char  optchar,
int  type 
) [private]

Definition at line 536 of file anyoption.cpp.

void addOptionError ( const char *  opt  )  [private]

Definition at line 560 of file anyoption.cpp.

Referenced by addOption().

Here is the caller graph for this function:

void addOptionError ( char  opt  )  [private]

Definition at line 571 of file anyoption.cpp.

bool findFlag ( char *  value  )  [private]

Definition at line 829 of file anyoption.cpp.

Referenced by getFlag().

Here is the caller graph for this function:

void addUsageError ( const char *  line  )  [private]

Definition at line 1166 of file anyoption.cpp.

Referenced by addUsage().

Here is the caller graph for this function:

bool CommandSet (  )  [private]

Definition at line 298 of file anyoption.cpp.

Referenced by processCommandArgs().

Here is the caller graph for this function:

bool FileSet (  )  [private]

Definition at line 304 of file anyoption.cpp.

Referenced by processFile().

Here is the caller graph for this function:

bool POSIX (  )  [private]

Definition at line 316 of file anyoption.cpp.

Referenced by addOption(), and processCommandArgs().

Here is the caller graph for this function:

char parsePOSIX ( char *  arg  )  [private]

Definition at line 653 of file anyoption.cpp.

Referenced by processCommandArgs().

Here is the caller graph for this function:

int parseGNU ( char *  arg  )  [private]

Definition at line 680 of file anyoption.cpp.

Referenced by processCommandArgs().

Here is the caller graph for this function:

bool matchChar ( char  c  )  [private]

Definition at line 738 of file anyoption.cpp.

Referenced by parsePOSIX().

Here is the caller graph for this function:

int matchOpt ( char *  opt  )  [private]

Definition at line 715 of file anyoption.cpp.

Referenced by parseGNU().

Here is the caller graph for this function:

char * readFile (  )  [private]

Definition at line 937 of file anyoption.cpp.

Referenced by processFile().

Here is the caller graph for this function:

char * readFile ( const char *  fname  )  [private]

Definition at line 947 of file anyoption.cpp.

bool consumeFile ( char *  buffer  )  [private]

Definition at line 971 of file anyoption.cpp.

Referenced by processFile().

Here is the caller graph for this function:

void processLine ( char *  theline,
int  length 
) [private]

Definition at line 1023 of file anyoption.cpp.

Referenced by consumeFile().

Here is the caller graph for this function:

char * chomp ( char *  str  )  [private]

Definition at line 1053 of file anyoption.cpp.

Referenced by justValue(), and valuePairs().

Here is the caller graph for this function:

void valuePairs ( char *  type,
char *  value 
) [private]

Definition at line 1065 of file anyoption.cpp.

Referenced by processLine().

Here is the caller graph for this function:

void justValue ( char *  value  )  [private]

Definition at line 1096 of file anyoption.cpp.

Referenced by processLine().

Here is the caller graph for this function:

void printVerbose ( const char *  msg  )  [private]

Definition at line 335 of file anyoption.cpp.

void printVerbose ( char *  msg  )  [private]

Definition at line 342 of file anyoption.cpp.

void printVerbose ( char  ch  )  [private]

Definition at line 349 of file anyoption.cpp.

void printVerbose (  )  [private]

Definition at line 329 of file anyoption.cpp.

Referenced by addOption(), justValue(), matchChar(), matchOpt(), parseGNU(), parsePOSIX(), processCommandArgs(), and valuePairs().

Here is the caller graph for this function:


Member Data Documentation

int argc [private]

Definition at line 163 of file anyoption.h.

Referenced by init(), processCommandArgs(), and useCommandArgs().

char** argv [private]

Definition at line 164 of file anyoption.h.

Referenced by getArgv(), init(), processCommandArgs(), and useCommandArgs().

const char* filename [private]

Definition at line 165 of file anyoption.h.

Referenced by init(), readFile(), and useFiileName().

char* appname [private]

Definition at line 166 of file anyoption.h.

Referenced by init(), and useCommandArgs().

int* new_argv [private]

Definition at line 168 of file anyoption.h.

Referenced by cleanup(), getArgv(), init(), and processCommandArgs().

int new_argc [private]

Definition at line 169 of file anyoption.h.

Referenced by getArgc(), getArgv(), init(), and processCommandArgs().

int max_legal_args [private]

Definition at line 170 of file anyoption.h.

Referenced by init(), and processCommandArgs().

int max_options [private]

Definition at line 174 of file anyoption.h.

Referenced by addOption(), alloc(), doubleOptStorage(), and init().

const char** options [private]

Definition at line 175 of file anyoption.h.

Referenced by addOption(), alloc(), cleanup(), doubleOptStorage(), getFlag(), getValue(), justValue(), matchOpt(), parseGNU(), processCommandArgs(), setFlagOn(), setValue(), and valuePairs().

int* optiontype [private]

Definition at line 176 of file anyoption.h.

Referenced by addOption(), alloc(), cleanup(), doubleOptStorage(), justValue(), matchOpt(), and valuePairs().

int* optionindex [private]

Definition at line 177 of file anyoption.h.

Referenced by addOption(), alloc(), cleanup(), doubleOptStorage(), getFlag(), getValue(), setFlagOn(), and setValue().

int option_counter [private]

Definition at line 178 of file anyoption.h.

Referenced by addOption(), getFlag(), getValue(), init(), justValue(), matchOpt(), setFlagOn(), setValue(), and valuePairs().

int max_char_options [private]

Definition at line 181 of file anyoption.h.

Referenced by addOption(), alloc(), doubleCharStorage(), and init().

char* optionchars [private]

Definition at line 182 of file anyoption.h.

Referenced by addOption(), alloc(), cleanup(), doubleCharStorage(), getFlag(), getValue(), justValue(), matchChar(), setFlagOn(), setValue(), and valuePairs().

int* optchartype [private]

Definition at line 183 of file anyoption.h.

Referenced by addOption(), alloc(), cleanup(), doubleCharStorage(), justValue(), matchChar(), and valuePairs().

int* optcharindex [private]

Definition at line 184 of file anyoption.h.

Referenced by addOption(), alloc(), cleanup(), doubleCharStorage(), getFlag(), getValue(), setFlagOn(), and setValue().

int optchar_counter [private]

Definition at line 185 of file anyoption.h.

Referenced by addOption(), getFlag(), getValue(), init(), justValue(), matchChar(), setFlagOn(), setValue(), and valuePairs().

char** values [private]

Definition at line 188 of file anyoption.h.

Referenced by cleanup(), getFlag(), getValue(), init(), setFlagOn(), setValue(), and valueStoreOK().

int g_value_counter [private]

Definition at line 189 of file anyoption.h.

Referenced by addOption(), init(), setCommandFlag(), setCommandOption(), setFileFlag(), setFileOption(), setFlag(), setOption(), and valueStoreOK().

const char** usage [private]

Definition at line 192 of file anyoption.h.

Referenced by addUsage(), alloc(), cleanup(), doubleUsageStorage(), and printUsage().

int max_usage_lines [private]

Definition at line 193 of file anyoption.h.

Referenced by addUsage(), alloc(), doubleUsageStorage(), and init().

int usage_lines [private]

Definition at line 194 of file anyoption.h.

Referenced by addUsage(), init(), and printUsage().

bool command_set [private]

Definition at line 196 of file anyoption.h.

Referenced by CommandSet(), init(), and useCommandArgs().

bool file_set [private]

Definition at line 197 of file anyoption.h.

Referenced by FileSet(), init(), and useFiileName().

bool mem_allocated [private]

Definition at line 198 of file anyoption.h.

Referenced by alloc(), init(), and ~AnyOption().

bool posix_style [private]

Definition at line 199 of file anyoption.h.

Referenced by init(), noPOSIX(), and POSIX().

bool verbose [private]

Definition at line 200 of file anyoption.h.

Referenced by init(), printVerbose(), and setVerbose().

bool print_usage [private]

Definition at line 201 of file anyoption.h.

bool print_help [private]

Definition at line 202 of file anyoption.h.

char opt_prefix_char [private]

Definition at line 204 of file anyoption.h.

Referenced by init(), processCommandArgs(), and setCommandPrefixChar().

char long_opt_prefix[MAX_LONG_PREFIX_LENGTH] [private]

Definition at line 205 of file anyoption.h.

Referenced by init(), processCommandArgs(), and setCommandLongPrefix().

char file_delimiter_char [private]

Definition at line 206 of file anyoption.h.

Referenced by init(), and setFileCommentChar().

char file_comment_char [private]

Definition at line 207 of file anyoption.h.

Referenced by init(), and setFileDelimiterChar().

char equalsign [private]

Definition at line 208 of file anyoption.h.

Referenced by init(), parseGNU(), and parsePOSIX().

char comment [private]

Definition at line 209 of file anyoption.h.

Referenced by consumeFile(), and init().

char delimiter [private]

Definition at line 210 of file anyoption.h.

Referenced by init(), and processLine().

char endofline [private]

Definition at line 211 of file anyoption.h.

Referenced by consumeFile(), and init().

char whitespace [private]

Definition at line 212 of file anyoption.h.

Referenced by chomp(), init(), and parsePOSIX().

char nullterminate [private]

Definition at line 213 of file anyoption.h.

Referenced by chomp(), init(), and processLine().

bool set [private]

Definition at line 215 of file anyoption.h.

Referenced by init(), and valueStoreOK().

bool once [private]

Definition at line 216 of file anyoption.h.

Referenced by init(), and printUsage().

bool hasoptions [private]

Definition at line 218 of file anyoption.h.

Referenced by hasOptions(), init(), and useCommandArgs().

bool autousage [private]

Definition at line 219 of file anyoption.h.

Referenced by autoUsagePrint(), init(), and printAutoUsage().


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