The objects of this class gather the expected command-line arguments and decode them. More...
#include <arg.h>
Public Member Functions | |
arguments () | |
The default constructor. | |
~arguments () | |
The destructor. | |
void | add (argelement *p) |
Adds an argument to the end of the list. | |
int | remove (char *name) |
Removes all the arguments with this name from the list and return the number of removed items. | |
int | analyze (int argc, char *argv[], std::ostream &out=std::cerr) |
Analyzes the arguments from the command line strings. | |
void | reset () |
Resets the flags and returns previous argument values (except for tables). | |
Private Member Functions | |
void | inctable () |
Increases the tables if necessary. | |
Private Attributes | |
int | n |
The number of arguments in the table. | |
int | length |
The allocated length of the table of arguments. | |
argelement ** | tab |
The table of pointers to specific arguments. | |
Friends | |
std::ostream & | operator<< (std::ostream &out, arguments &p) |
Displays the arguments actually decoded (for debugging purpose). |
The objects of this class gather the expected command-line arguments and decode them.
It is recommended that you use the various functions called "arg" to enqueue the arguments into the list of arguments. When the list is complete, one just calls the "analyze" method of the class. Detailed instructions are gathered in the "arg.txt" file. The program "argtest.cpp" and most CHomP programs very well illustrate how to use various features of this class.
Definition at line 534 of file arg.h.
chomp::homology::arguments::arguments | ( | ) | [inline] |
chomp::homology::arguments::~arguments | ( | ) |
The destructor.
void chomp::homology::arguments::add | ( | argelement * | p | ) | [inline] |
int chomp::homology::arguments::analyze | ( | int | argc, | |
char * | argv[], | |||
std::ostream & | out = std::cerr | |||
) |
Analyzes the arguments from the command line strings.
Returns a negative value in case of error (the negation of the number of errors) and displays error messages to the given output stream. Returns 1 if it is requested to stop the program (and show help information, for instance). Returns 0 otherwise.
void chomp::homology::arguments::inctable | ( | ) | [private] |
Increases the tables if necessary.
Referenced by add().
int chomp::homology::arguments::remove | ( | char * | name | ) |
Removes all the arguments with this name from the list and return the number of removed items.
void chomp::homology::arguments::reset | ( | ) |
Resets the flags and returns previous argument values (except for tables).
std::ostream& operator<< | ( | std::ostream & | out, | |
arguments & | p | |||
) | [friend] |
Displays the arguments actually decoded (for debugging purpose).
int chomp::homology::arguments::length [private] |
The allocated length of the table of arguments.
Definition at line 572 of file arg.h.
Referenced by arguments().
int chomp::homology::arguments::n [private] |
The number of arguments in the table.
Definition at line 569 of file arg.h.
Referenced by add(), and arguments().
argelement** chomp::homology::arguments::tab [private] |
The table of pointers to specific arguments.
Definition at line 575 of file arg.h.
Referenced by add(), and arguments().