The Original CHomP Software
Public Member Functions | Private Attributes | List of all members
chomp::homology::argelement Class Referenceabstract

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 >

Public Member Functions

 argelement (const char *_name)
 The constructor. More...
 
virtual ~argelement ()
 The destructor. More...
 
const char * getname () const
 Returns the name of the command-line argument. More...
 
char * getvalue (char *str)
 Returns the argument's value string from the argument string or returns 0 if it is not this argument. More...
 
virtual int setvalue (char *str, char *next)=0
 Sets the value of this argument according to the string. More...
 
virtual void restore ()=0
 Restores the previous argument value (except for tables). More...
 
virtual void show (std::ostream &out) const =0
 Outputs the argument element to the output stream. More...
 
void resetflags ()
 Resets the flags. More...
 
void set (int flag)
 Sets the given flag. More...
 
void unset (int flag)
 Unsets (clears) the given flag. More...
 
bool get (int flag) const
 Returns the value of the given flag. More...
 

Private Attributes

char * name
 The argument name (without '-'). More...
 
argflags flags
 The flags associated with this argument. More...
 

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 136 of file arg.h.

Constructor & Destructor Documentation

◆ argelement()

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

The constructor.

Definition at line 185 of file arg.h.

185 : flags ()
186{
187 if (!_name || !*_name)
188 name = NULL;
189 else
190 {
191 name = new char [strlen (_name) + 1];
192 strcpy (name, _name);
193 }
194 return;
195} /* argelement::argelement */
argflags flags
The flags associated with this argument.
Definition: arg.h:181
char * name
The argument name (without '-').
Definition: arg.h:178

References name.

◆ ~argelement()

chomp::homology::argelement::~argelement ( )
inlinevirtual

The destructor.

Definition at line 197 of file arg.h.

198{
199 if (name)
200 delete [] name;
201 return;
202} /* argelement::~argelement */

References name.

Member Function Documentation

◆ get()

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

Returns the value of the given flag.

Definition at line 230 of file arg.h.

231{
232 return flags. get (flag);
233} /* argelement::get */
bool get(int flag) const
Returns the value of the given flag.
Definition: arg.h:230

References flags, and get().

Referenced by get().

◆ getname()

const char * chomp::homology::argelement::getname ( ) const
inline

Returns the name of the command-line argument.

Definition at line 204 of file arg.h.

205{
206 return name;
207} /* argelement::getname */

References name.

◆ getvalue()

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.

◆ resetflags()

void chomp::homology::argelement::resetflags ( )
inline

◆ restore()

virtual void chomp::homology::argelement::restore ( )
pure virtual

Restores the previous argument value (except for tables).

Implemented in chomp::homology::argunit< type >.

◆ set()

void chomp::homology::argelement::set ( int  flag)
inline

Sets the given flag.

Definition at line 218 of file arg.h.

219{
220 flags. set (flag);
221 return;
222} /* argelement::set */
void set(int flag)
Sets the given flag.
Definition: arg.h:218

References flags, and set().

Referenced by chomp::homology::argunit< type >::argunit(), and set().

◆ setvalue()

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

◆ show()

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

◆ unset()

void chomp::homology::argelement::unset ( int  flag)
inline

Unsets (clears) the given flag.

Definition at line 224 of file arg.h.

225{
226 flags. unset (flag);
227 return;
228} /* argelement::unset */

References flags, and unset().

Referenced by resetflags(), and unset().

Member Data Documentation

◆ flags

argflags chomp::homology::argelement::flags
private

The flags associated with this argument.

Definition at line 181 of file arg.h.

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

◆ name

char* chomp::homology::argelement::name
private

The argument name (without '-').

This string dynamically allocated.

Definition at line 178 of file arg.h.

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


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