# cEnum Class Reference
[Internal classes]

`#include <cenum.h>`

Inheritance diagram for cEnum:

List of all members.

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

## Public Member Functions

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 cPolymorphic * | dup () const
virtual std::string | info () const
Insertion and lookup.
void | insert (int key, const char *str)
const char * | stringFor (int key)
int | lookup (const char *str, int fallback=-1)

## Constructor & Destructor Documentation

cEnum::cEnum | ( | const cEnum & | cenum | ) |

| Copy constructor.

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

| Constructor.

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

| Destructor.

## Member Function Documentation

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

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

virtual std::string cEnum::info | ( |  | ) | const`[virtual]`

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

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