Main Page Modules Class Hierarchy Compound List File List Compound Members

# cEnum Class Reference

`#include <cenum.h>`

Inheritance diagram for cEnum::

List of all members.

## Public Methods

Constructors, destructor, assignment.
| cEnum (const cEnum &cenum)
| cEnum (const char *name=NULL, int siz=17)
virtual | ~cEnum ()
cEnum& | operator= (const cEnum &list)
Redefined cObject member functions.
virtual cObject* | dup () const
virtual void | info (char *buf)
Insertion and lookup.
void | insert (int key, const char *str)
const char* | stringFor (int key)
int | lookup (const char *str, int fallback=-1)

## Detailed Description

Provides string representation for enums. The class basically implements effective integer-to-string mapping. Primary usage is to support displaying symbolic names for integer values that represent some code (such as an enum or define). To be used mostly from Tkenv and possibly other user interfaces.

See also:
  sEnumBuilder

## Constructor & Destructor Documentation

cEnum::cEnum ( | const cEnum & cenum )

| Copy constructor.

cEnum::cEnum ( | const char * name = NULL,
| int siz = 17 )

| Constructor.

cEnum::~cEnum ( | )`[virtual]`

| Destructor.

## Member Function Documentation

cObject * cEnum::dup ( | ) const`[inline, virtual]`

| Creates and returns an exact copy of this object. See cObject for more details. Reimplemented from cObject.

void cEnum::info ( | char * buf )`[virtual]`

| Produces a one-line description of object contents into the buffer passed as argument. See cObject for more details. Reimplemented from cObject.

void cEnum::insert ( | int key,
| const char * str )

| Add an item to the enum. If that numeric code exist, overwrite it.

int cEnum::lookup ( | const char * str,
| int fallback = -1 )

| Look up string and return numeric code. If not found, return second argument (or -1).

cEnum & cEnum::operator= ( | const cEnum & list )

| Assignment operator. The name member doesn't get copied; see cObject's operator=() for more details.

const char * cEnum::stringFor ( | int key )

| Look up key and return string representation. Return NULL if not found.

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

- cenum.h