Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ion::base::EnumHelper Class Reference

}; static const char* kStrings[] = { "Value1", "Value2", "Value3" }; return EnumData<Values>(IndexMap<Values, uint32>(kValues, 3), kStrings); } More...

#include "enumhelper.h"

Public Member Functions

template<>
ION_API const
EnumHelper::EnumData
< BufferObject::ComponentType > 
GetEnumData ()
 Specialize for BufferObject::ComponentType. More...
 
template<>
ION_API const
EnumHelper::EnumData
< BufferObject::Target > 
GetEnumData ()
 
template<>
ION_API const
EnumHelper::EnumData
< BufferObject::UsageMode > 
GetEnumData ()
 Specialize for BufferObject::UsageMode. More...
 
template<>
ION_API const
EnumHelper::EnumData
< CubeMapTexture::CubeFace > 
GetEnumData ()
 Specialize for CubeMapTexture::Face. More...
 
template<>
ION_API const
EnumHelper::EnumData
< Image::Dimensions > 
GetEnumData ()
 Specialize for Image::Dimension. More...
 
template<>
ION_API const
EnumHelper::EnumData
< Image::Type > 
GetEnumData ()
 Specialize for Image::Type. More...
 
template<>
ION_API const
EnumHelper::EnumData
< Sampler::CompareFunction > 
GetEnumData ()
 Specialize for Sampler::CompareFunction. More...
 
template<>
ION_API const
EnumHelper::EnumData
< Sampler::CompareMode > 
GetEnumData ()
 Specialize for Sampler::CompareMode. More...
 
template<>
ION_API const
EnumHelper::EnumData
< Sampler::FilterMode > 
GetEnumData ()
 Specialize for Sampler::FilterMode. More...
 
template<>
ION_API const
EnumHelper::EnumData
< Sampler::WrapMode > 
GetEnumData ()
 Specialize for Sampler::WrapMode. More...
 
template<>
ION_API const
EnumHelper::EnumData
< Shape::PrimitiveType > 
GetEnumData ()
 Specialize for Shape::PrimitiveType. More...
 
template<>
ION_API const
EnumHelper::EnumData
< StateTable::Capability > 
GetEnumData ()
 The unspecialized version of GetEnumData() should never be called, as it will result in a link-time error. More...
 
template<>
ION_API const
EnumHelper::EnumData
< StateTable::BlendEquation > 
GetEnumData ()
 Specialize for StateTable::BlendEquation. More...
 
template<>
ION_API const
EnumHelper::EnumData
< StateTable::BlendFunctionFactor > 
GetEnumData ()
 Specialize for StateTable::BlendFunctionFactor. More...
 
template<>
ION_API const
EnumHelper::EnumData
< StateTable::CullFaceMode > 
GetEnumData ()
 Specialize for StateTable::CullFaceMode. More...
 
template<>
ION_API const
EnumHelper::EnumData
< StateTable::DepthFunction > 
GetEnumData ()
 Specialize for StateTable::DepthFunction. More...
 
template<>
ION_API const
EnumHelper::EnumData
< StateTable::DrawBuffer > 
GetEnumData ()
 Specialize for StateTable::DrawBuffer. More...
 
template<>
ION_API const
EnumHelper::EnumData
< StateTable::FrontFaceMode > 
GetEnumData ()
 Specialize for StateTable::FrontFaceMode. More...
 
template<>
ION_API const
EnumHelper::EnumData
< StateTable::HintMode > 
GetEnumData ()
 Specialize for StateTable::HintMode. More...
 
template<>
ION_API const
EnumHelper::EnumData
< StateTable::StencilFunction > 
GetEnumData ()
 Specialize for StateTable::StencilFunction. More...
 
template<>
ION_API const
EnumHelper::EnumData
< StateTable::StencilOperation > 
GetEnumData ()
 Specialize for StateTable::StencilOperation. More...
 
template<>
ION_API const
EnumHelper::EnumData
< Texture::Swizzle > 
GetEnumData ()
 Specialize for Texture::Swizzle. More...
 

Static Public Member Functions

template<typename EnumType >
static const char * GetString (EnumType e)
 Returns a string corresponding to an enum. More...
 
template<typename EnumType >
static const IndexMap
< EnumType, uint32 > 
GetIndexMap ()
 Creates and returns an IndexMap instance that can be used to convert between enums of the given type and constants. More...
 
template<typename EnumType >
static size_t GetCount ()
 Returns the number of values corresponding to an enum. More...
 
template<typename EnumType >
static uint32 GetConstant (EnumType e)
 Returns the constant value corresponding to an enum. More...
 
template<typename EnumType >
static EnumType GetEnum (uint32 c)
 Returns the enum corresponding to a constant value. More...
 

Detailed Description

}; static const char* kStrings[] = { "Value1", "Value2", "Value3" }; return EnumData<Values>(IndexMap<Values, uint32>(kValues, 3), kStrings); }

Calling EnumHelper::GetString(kValue1) would return "Value1," while EnumHelper::GetConstant(kValue2) would return 2U, and EnumHelper::GetEnum<Values>(3U) would return kValue3.

Note
the specialization of GetEnumData() must be in the ion::base namespace.

Definition at line 56 of file enumhelper.h.

Member Function Documentation

template<typename EnumType >
static uint32 ion::base::EnumHelper::GetConstant ( EnumType  e)
inlinestatic

Returns the constant value corresponding to an enum.

Definition at line 80 of file enumhelper.h.

template<typename EnumType >
static size_t ion::base::EnumHelper::GetCount ( )
inlinestatic

Returns the number of values corresponding to an enum.

Definition at line 75 of file enumhelper.h.

template<typename EnumType >
static EnumType ion::base::EnumHelper::GetEnum ( uint32  c)
inlinestatic

Returns the enum corresponding to a constant value.

Definition at line 85 of file enumhelper.h.

template<>
ION_API const EnumHelper::EnumData<Sampler::CompareFunction> ion::base::EnumHelper::GetEnumData ( )

Specialize for Sampler::CompareFunction.

Definition at line 53 of file sampler.cc.

References ION_STATIC_ASSERT.

template<>
ION_API const EnumHelper::EnumData<Sampler::CompareMode> ion::base::EnumHelper::GetEnumData ( )

Specialize for Sampler::CompareMode.

Definition at line 72 of file sampler.cc.

References ION_STATIC_ASSERT.

template<>
ION_API const EnumHelper::EnumData<CubeMapTexture::CubeFace> ion::base::EnumHelper::GetEnumData ( )

Specialize for CubeMapTexture::Face.

Definition at line 83 of file cubemaptexture.cc.

References ION_STATIC_ASSERT.

template<>
ION_API const EnumHelper::EnumData<Sampler::FilterMode> ion::base::EnumHelper::GetEnumData ( )

Specialize for Sampler::FilterMode.

Definition at line 84 of file sampler.cc.

References ION_STATIC_ASSERT.

template<>
ION_API const EnumHelper::EnumData<Sampler::WrapMode> ion::base::EnumHelper::GetEnumData ( )

Specialize for Sampler::WrapMode.

Definition at line 102 of file sampler.cc.

References ION_STATIC_ASSERT.

template<>
ION_API const EnumHelper::EnumData<Shape::PrimitiveType> ion::base::EnumHelper::GetEnumData ( )

Specialize for Shape::PrimitiveType.

Definition at line 103 of file shape.cc.

References ION_STATIC_ASSERT.

template<>
ION_API const EnumHelper::EnumData<BufferObject::ComponentType> ion::base::EnumHelper::GetEnumData ( )

Specialize for BufferObject::ComponentType.

Definition at line 105 of file bufferobject.cc.

References ION_STATIC_ASSERT.

template<>
ION_API const EnumHelper::EnumData<BufferObject::Target> ion::base::EnumHelper::GetEnumData ( )

Definition at line 123 of file bufferobject.cc.

References ION_STATIC_ASSERT.

template<>
ION_API const EnumHelper::EnumData<BufferObject::UsageMode> ion::base::EnumHelper::GetEnumData ( )

Specialize for BufferObject::UsageMode.

Definition at line 144 of file bufferobject.cc.

References ION_STATIC_ASSERT.

template<>
ION_API const EnumHelper::EnumData<Texture::Swizzle> ion::base::EnumHelper::GetEnumData ( )

Specialize for Texture::Swizzle.

Definition at line 235 of file texture.cc.

References ION_STATIC_ASSERT.

template<>
ION_API const EnumHelper::EnumData<StateTable::Capability> ion::base::EnumHelper::GetEnumData ( )

The unspecialized version of GetEnumData() should never be called, as it will result in a link-time error.

Specialize for StateTable::Capability.

Definition at line 518 of file statetable.cc.

References ION_CHECK_ARRAYS.

template<>
ION_API const EnumHelper::EnumData<StateTable::BlendEquation> ion::base::EnumHelper::GetEnumData ( )

Specialize for StateTable::BlendEquation.

Definition at line 554 of file statetable.cc.

References ION_CHECK_ARRAYS.

template<>
ION_API const EnumHelper::EnumData<StateTable::BlendFunctionFactor> ion::base::EnumHelper::GetEnumData ( )

Specialize for StateTable::BlendFunctionFactor.

Definition at line 571 of file statetable.cc.

References ION_CHECK_ARRAYS.

template<>
ION_API const EnumHelper::EnumData<Image::Dimensions> ion::base::EnumHelper::GetEnumData ( )

Specialize for Image::Dimension.

Definition at line 579 of file image.cc.

References ION_STATIC_ASSERT.

template<>
ION_API const EnumHelper::EnumData<Image::Type> ion::base::EnumHelper::GetEnumData ( )

Specialize for Image::Type.

Definition at line 591 of file image.cc.

References ION_STATIC_ASSERT.

template<>
ION_API const EnumHelper::EnumData<StateTable::CullFaceMode> ion::base::EnumHelper::GetEnumData ( )

Specialize for StateTable::CullFaceMode.

Definition at line 594 of file statetable.cc.

References ION_CHECK_ARRAYS.

template<>
ION_API const EnumHelper::EnumData<StateTable::DepthFunction> ion::base::EnumHelper::GetEnumData ( )

Specialize for StateTable::DepthFunction.

Definition at line 610 of file statetable.cc.

References ION_CHECK_ARRAYS.

template<>
ION_API const EnumHelper::EnumData<StateTable::DrawBuffer> ion::base::EnumHelper::GetEnumData ( )

Specialize for StateTable::DrawBuffer.

Definition at line 629 of file statetable.cc.

References ION_CHECK_ARRAYS.

template<>
ION_API const EnumHelper::EnumData<StateTable::FrontFaceMode> ion::base::EnumHelper::GetEnumData ( )

Specialize for StateTable::FrontFaceMode.

Definition at line 645 of file statetable.cc.

References ION_CHECK_ARRAYS.

template<>
ION_API const EnumHelper::EnumData<StateTable::HintMode> ion::base::EnumHelper::GetEnumData ( )

Specialize for StateTable::HintMode.

Definition at line 659 of file statetable.cc.

References ION_CHECK_ARRAYS.

template<>
ION_API const EnumHelper::EnumData<StateTable::StencilFunction> ion::base::EnumHelper::GetEnumData ( )

Specialize for StateTable::StencilFunction.

Definition at line 673 of file statetable.cc.

References ION_CHECK_ARRAYS.

template<>
ION_API const EnumHelper::EnumData<StateTable::StencilOperation> ion::base::EnumHelper::GetEnumData ( )

Specialize for StateTable::StencilOperation.

Definition at line 691 of file statetable.cc.

References ION_CHECK_ARRAYS.

template<typename EnumType >
static const IndexMap<EnumType, uint32> ion::base::EnumHelper::GetIndexMap ( )
inlinestatic

Creates and returns an IndexMap instance that can be used to convert between enums of the given type and constants.

This function must be specialized for each enum type; each specialization contains a static array of constants in the proper order.

Definition at line 70 of file enumhelper.h.

template<typename EnumType >
static const char* ion::base::EnumHelper::GetString ( EnumType  e)
inlinestatic

Returns a string corresponding to an enum.

Definition at line 59 of file enumhelper.h.


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