oasys::EnumOpt Class Reference

#include <Options.h>

Inheritance diagram for oasys::EnumOpt:

oasys::Opt List of all members.

Detailed Description

Option class to select one of a set of potential values based on string keys.

Definition at line 481 of file Options.h.

Public Member Functions

 EnumOpt (const char *opt, Case *cases, int *valp, const char *valdesc="", const char *desc="", bool *setp=NULL)
 Basic constructor.
 EnumOpt (char shortopt, const char *longopt, Case *cases, int *valp, const char *valdesc="", const char *desc="", bool *setp=NULL)
 Alternative constructor with both short and long options, suitable for getopt calls.

Protected Member Functions

int set (const char *val, size_t len)
 Virtual callback to set the option to the given string value.
void get (StringBuffer *buf)
 Virtual callback to get a string version of the current value.

Protected Attributes

Casecases_

Classes

struct  Case


Constructor & Destructor Documentation

oasys::EnumOpt::EnumOpt ( const char *  opt,
Case cases,
int *  valp,
const char *  valdesc = "",
const char *  desc = "",
bool setp = NULL 
)

Basic constructor.

Parameters:
opt option string
cases pointer to the array of cases
valp pointer to the value
valdesc short description for the value
desc descriptive string
setp optional pointer to indicate whether or not the option was set

Definition at line 468 of file Options.cc.

oasys::EnumOpt::EnumOpt ( char  shortopt,
const char *  longopt,
Case cases,
int *  valp,
const char *  valdesc = "",
const char *  desc = "",
bool setp = NULL 
)

Alternative constructor with both short and long options, suitable for getopt calls.

Parameters:
shortopt short option character
longopt long option string
cases pointer to the array of cases
valp pointer to the value
valdesc short description for the value
desc descriptive string
setp optional pointer to indicate whether or not the option was set

Definition at line 475 of file Options.cc.


Member Function Documentation

int oasys::EnumOpt::set ( const char *  val,
size_t  len 
) [protected, virtual]

Virtual callback to set the option to the given string value.

Implements oasys::Opt.

Definition at line 485 of file Options.cc.

References cases_, oasys::Opt::setp_, oasys::EnumOpt::Case::val, and oasys::Opt::valp_.

void oasys::EnumOpt::get ( StringBuffer buf  )  [protected, virtual]

Virtual callback to get a string version of the current value.

Implements oasys::Opt.

Definition at line 510 of file Options.cc.

References oasys::StringBuffer::append(), cases_, and oasys::Opt::valp_.


Member Data Documentation

Case* oasys::EnumOpt::cases_ [protected]

Definition at line 524 of file Options.h.

Referenced by get(), and set().


The documentation for this class was generated from the following files:
Generated on Thu Jun 7 12:54:37 2007 for DTN Reference Implementation by  doxygen 1.5.1