NeoPZ
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
clarg::arg_base Class Referenceabstract

#include <arglib.h>

Inheritance diagram for clarg::arg_base:
[legend]

Public Member Functions

 arg_base (const char *name, const char *desc)
 
const string & get_name () const
 
const string & get_desc () const
 
bool was_set () const
 
void mark_set (bool m)
 

Protected Member Functions

virtual int parse_parameters (int argc, char *argv [])=0
 
virtual void write_parameters (ostream &os, bool def=false) const =0
 

Protected Attributes

bool arg_set
 
string arg_name
 
string arg_desc
 

Friends

class args_container
 

Detailed Description

The base argument class. Manages arguments names and descriptions.

Definition at line 127 of file arglib.h.

Constructor & Destructor Documentation

◆ arg_base()

clarg::arg_base::arg_base ( const char *  name,
const char *  desc 
)

Member Function Documentation

◆ get_desc()

const string& clarg::arg_base::get_desc ( ) const
inline

◆ get_name()

const string& clarg::arg_base::get_name ( ) const
inline

◆ mark_set()

void clarg::arg_base::mark_set ( bool  m)
inline

Definition at line 140 of file arglib.h.

References m.

Referenced by clarg::args_container::parse_arguments().

◆ parse_parameters()

virtual int clarg::arg_base::parse_parameters ( int  argc,
char *  argv[] 
)
protectedpure virtual

Parse the argument parameters. Must be implemented by the specialized argument class. When parsing, make sure you copy the parsed parameters into the arg_parameters array. Returns the number of parameters parsed if ok, -1 if an error occured.

Implemented in clarg::argBool, clarg::argDouble, clarg::argInt, and clarg::argString.

Referenced by clarg::args_container::parse_arguments().

◆ was_set()

bool clarg::arg_base::was_set ( ) const
inline

◆ write_parameters()

virtual void clarg::arg_base::write_parameters ( ostream &  os,
bool  def = false 
) const
protectedpure virtual

write the argument parameters into the output stream.

Implemented in clarg::argBool, clarg::argDouble, clarg::argInt, and clarg::argString.

Friends And Related Function Documentation

◆ args_container

friend class args_container
friend

Definition at line 164 of file arglib.h.

Member Data Documentation

◆ arg_desc

string clarg::arg_base::arg_desc
protected

The argument description.

Definition at line 162 of file arglib.h.

◆ arg_name

string clarg::arg_base::arg_name
protected

The argument name.

Definition at line 160 of file arglib.h.

◆ arg_set

bool clarg::arg_base::arg_set
protected

True if the argument was set

Definition at line 158 of file arglib.h.


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