Public Member Functions | Private Attributes

chomp::homology::argelement Class Reference

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>

Inheritance diagram for chomp::homology::argelement:
chomp::homology::argunit< type >

List of all members.

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.

Detailed Description

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.


Constructor & Destructor Documentation

chomp::homology::argelement::argelement ( const char *  _name  )  [inline]

The constructor.

Definition at line 186 of file arg.h.

References name.

                                               : flags ()
{
        if (!_name || !*_name)
                name = NULL;
        else
        {
                name = new char [strlen (_name) + 1];
                strcpy (name, _name);
        }
        return;
} /* argelement::argelement */

chomp::homology::argelement::~argelement (  )  [inline, virtual]

The destructor.

Definition at line 198 of file arg.h.

References name.

{
        if (name)
                delete [] name;
        return;
} /* argelement::~argelement */


Member Function Documentation

bool chomp::homology::argelement::get ( int  flag  )  const [inline]

Returns the value of the given flag.

Definition at line 231 of file arg.h.

References flags.

{
        return flags. get (flag);
} /* argelement::get */

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]
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]

Sets the given flag.

Definition at line 219 of file arg.h.

References flags.

{
        flags. set (flag);
        return;
} /* argelement::set */

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]

Unsets (clears) the given flag.

Definition at line 225 of file arg.h.

References flags.

Referenced by resetflags().

{
        flags. unset (flag);
        return;
} /* argelement::unset */


Member Data Documentation

The flags associated with this argument.

Definition at line 182 of file arg.h.

Referenced by get(), resetflags(), set(), and unset().

The argument name (without '-').

This string dynamically allocated.

Definition at line 179 of file arg.h.

Referenced by argelement(), getname(), and ~argelement().


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