This is a helper class which defines common properties of a command-line argument bound with any type of a variable. More...
#include <arg.h>
Public Member Functions | |
| argelement (const char *_name) | |
| The constructor. | |
| virtual | ~argelement () |
| The destructor. | |
| const char * | getname () const |
| Returns the name of the command-line argument. | |
| char * | getvalue (char *str) |
| Returns the argument's value string from the argument string or returns 0 if it is not this argument. | |
| virtual int | setvalue (char *str, char *next)=0 |
| Sets the value of this argument according to the string. | |
| virtual void | restore ()=0 |
| Restores the previous argument value (except for tables). | |
| virtual void | show (std::ostream &out) const =0 |
| Outputs the argument element to the output stream. | |
| void | resetflags () |
| Resets the flags. | |
| void | set (int flag) |
| Sets the given flag. | |
| void | unset (int flag) |
| Unsets (clears) the given flag. | |
| bool | get (int flag) const |
| Returns the value of the given flag. | |
Private Attributes | |
| char * | name |
| The argument name (without '-'). | |
| argflags | flags |
| The flags associated with this argument. | |
This is a helper class which defines common properties of a command-line argument bound with any type of a variable.
Definition at line 137 of file arg.h.
| chomp::homology::argelement::argelement | ( | const char * | _name | ) | [inline] |
| chomp::homology::argelement::~argelement | ( | ) | [inline, virtual] |
| bool chomp::homology::argelement::get | ( | int | flag | ) | const [inline] |
| const char * chomp::homology::argelement::getname | ( | ) | const [inline] |
Returns the name of the command-line argument.
Definition at line 205 of file arg.h.
References name.
Referenced by chomp::homology::argunit< type >::show().
{
return name;
} /* argelement::getname */
| char* chomp::homology::argelement::getvalue | ( | char * | str | ) |
Returns the argument's value string from the argument string or returns 0 if it is not this argument.
| void chomp::homology::argelement::resetflags | ( | ) | [inline] |
Resets the flags.
Definition at line 210 of file arg.h.
References chomp::homology::argflags::filled, flags, chomp::homology::argflags::missingvalue, chomp::homology::argflags::readerror, chomp::homology::argflags::toomany, and unset().
Referenced by chomp::homology::argunit< type >::restore().
{
flags. unset (argflags::filled);
flags. unset (argflags::readerror);
flags. unset (argflags::toomany);
flags. unset (argflags::missingvalue);
return;
} /* argelement::resetflags */
| virtual void chomp::homology::argelement::restore | ( | ) | [pure virtual] |
Restores the previous argument value (except for tables).
Implemented in chomp::homology::argunit< type >.
| void chomp::homology::argelement::set | ( | int | flag | ) | [inline] |
| virtual int chomp::homology::argelement::setvalue | ( | char * | str, | |
| char * | next | |||
| ) | [pure virtual] |
Sets the value of this argument according to the string.
If necessary, the next argument may be used. Returns: 0 = Ok, -1 = Error, 1 = next used.
Implemented in chomp::homology::argunit< type >.
| virtual void chomp::homology::argelement::show | ( | std::ostream & | out | ) | const [pure virtual] |
Outputs the argument element to the output stream.
Implemented in chomp::homology::argunit< type >.
| void chomp::homology::argelement::unset | ( | int | flag | ) | [inline] |
argflags chomp::homology::argelement::flags [private] |
char* chomp::homology::argelement::name [private] |
The argument name (without '-').
This string dynamically allocated.
Definition at line 179 of file arg.h.
Referenced by argelement(), getname(), and ~argelement().
1.7.1