Wt::Enum< CHILD > Class Template Reference

typesafe enumaration like class More...

#include <enum.h>

Inheritance diagram for Wt::Enum< CHILD >:

Inheritance graph
Collaboration diagram for Wt::Enum< CHILD >:

Collaboration graph
List of all members.

Static Private Attributes

static int enum_next = 0
static std::vector< intdefined


class  Member
class  Var
class  VarBase

Detailed Description

template<typename CHILD>
class Wt::Enum< CHILD >

typesafe enumaration like class

Usage example class ColorEnum : public Enum<ColorEnum> { public: static const Member Red; static const Member Green; static const Member Purple; static const Member Black; };

Initialization ColorEnum::Member Red = 2; ColorEnum::Member Green; // implied 3 ColorEnum::Member Purple = 47; // forced 47 ColorEnum::Member Black; // implied 48

Now ColorEnum::Var some_color = Red; //ok; some_color = 3 //ok some_color = 9999 //failed at runtime: assertion && exception

Definition at line 55 of file enum.h.

Member Data Documentation

template<typename CHILD>
std::vector< int > Wt::Enum< CHILD >::defined [static, private]

Definition at line 58 of file enum.h.

Referenced by Wt::Enum< CHILD >::VarBase::operator int(), Wt::Enum< CHILD >::Var::operator=(), and Wt::Enum< CHILD >::Member::store().

template<typename CHILD>
int Wt::Enum< CHILD >::enum_next = 0 [static, private]

Definition at line 57 of file enum.h.

Referenced by Wt::Enum< CHILD >::Member::Member(), and Wt::Enum< CHILD >::Member::store().

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

Generated Fri Jul 28 19:28:08 2006.
Copyright © 1998-2003 by the respective authors.

This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.