Quark  0.1
EnumTraits< E > Class Template Reference

A collection of static methods for accessing enum type metadata. More...

#include <EnumTraits.h++>

Static Public Member Functions

static E defaultValue ()
 Returns the enumeration's "default" value. More...
 
static E invalidValue ()
 Returns the enumeration's "invalid" value. More...
 
static const QList< E > values ()
 Returns the list of valid enum values for this enum type. More...
 
static const QStringList labels ()
 Returns the list of string labels for this enum type. More...
 
static E fromLabel (const QString &label)
 Converts a label to an enum value. More...
 
static QString toLabel (E value)
 Converts an enum value to its corresponding string label. More...
 
static E fromInt (int value)
 Converts an integer to an enum value. More...
 
static int toInt (E value)
 Converts an enum value to the corresponding integer value. More...
 
static int ordinal (E value)
 Returns the ordinal for the given enum value. More...
 
static E valueAt (int ordinal)
 Returns the enum value for the given ordinal, or the "invalid" value if the ordinal is invalid for this enum type. More...
 

Detailed Description

template<typename E>
class quark::util::EnumTraits< E >

A collection of static methods for accessing enum type metadata.

Use the QUARK_DECLARE_ENUM_TRAITS() macro to make an enum type work with these methods.

Author
Mark Lindner

Member Function Documentation

◆ defaultValue()

static E defaultValue ( )
inlinestatic

Returns the enumeration's "default" value.

◆ fromInt()

static E fromInt ( int  value)
inlinestatic

Converts an integer to an enum value.

If the integer value does not correspond to any valid value for this enum type, the "invalid" value is returned.

◆ fromLabel()

static E fromLabel ( const QString &  label)
inlinestatic

Converts a label to an enum value.

If the label does not correspond to any valid value for this enum, the enum's "invalid" value is returned.

◆ invalidValue()

static E invalidValue ( )
inlinestatic

Returns the enumeration's "invalid" value.

◆ labels()

static const QStringList labels ( )
inlinestatic

Returns the list of string labels for this enum type.

◆ ordinal()

static int ordinal ( value)
inlinestatic

Returns the ordinal for the given enum value.

◆ toInt()

static int toInt ( value)
inlinestatic

Converts an enum value to the corresponding integer value.

◆ toLabel()

static QString toLabel ( value)
inlinestatic

Converts an enum value to its corresponding string label.

◆ valueAt()

static E valueAt ( int  ordinal)
inlinestatic

Returns the enum value for the given ordinal, or the "invalid" value if the ordinal is invalid for this enum type.

◆ values()

static const QList<E> values ( )
inlinestatic

Returns the list of valid enum values for this enum type.


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