Main Page   Compound List   File List   Compound Members   File Members  

Fruit Class Reference

An example class that makes use of the EnumTranslate template. More...

List of all members.

Public Types

enum  fruit {
  badEnum, apples, oranges, pears,
  peaches, lastEnum
}

Public Methods

virtual const fruit enumVal (const char *name)
 Given a C string, return the associated enumeration value. More...

virtual const char * enumName (fruit val)
 Given an enumeration value, return the association string. More...


Private Attributes

EnumTranslate< fruitt


Detailed Description

An example class that makes use of the EnumTranslate template.

The template is instantiated with the local enumeration set fruit.

Definition at line 146 of file enumTranslate.cpp.


Member Enumeration Documentation

enum Fruit::fruit
 

Enumeration values:
badEnum  
apples  
oranges  
pears  
peaches  
lastEnum  

Definition at line 148 of file enumTranslate.cpp.

00148                 {
00149       badEnum,
00150       apples,
00151       oranges,
00152       pears,
00153       peaches,
00154       lastEnum } fruit;


Member Function Documentation

virtual const char* Fruit::enumName fruit   val [inline, virtual]
 

Given an enumeration value, return the association string.

If the enumeraton value is out of range, the function will assert()

Definition at line 168 of file enumTranslate.cpp.

Referenced by main().

00169    {
00170       assert( val > badEnum && val < lastEnum );
00171       return t.enumName( val );
00172    }

virtual const fruit Fruit::enumVal const char *   name [inline, virtual]
 

Given a C string, return the associated enumeration value.

Definition at line 161 of file enumTranslate.cpp.

00162    {
00163       return t.enumVal( name );
00164    }


Member Data Documentation

EnumTranslate<fruit> Fruit::t [private]
 

Definition at line 157 of file enumTranslate.cpp.


The documentation for this class was generated from the following file:
Generated at Mon May 13 14:07:32 2002 for An Enumeration to const char * translation template by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001