TrueReality  v0.1.1912
EnumerationString.h File Reference
#include "Export.h"
#include <trUtil/WarningUtils.h>
#include <ostream>
#include <string>
#include <vector>
Include dependency graph for EnumerationString.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  trUtil::EnumerationString
 This class represents a type-safe EnumerationString pattern. More...
 
class  trUtil::EnumerationPointer< T >
 EnumerationString Pointer class holds a reference to a passed in Enumeration. More...
 

Namespaces

 trUtil
 Namespace that holds various utility classes for the engine.
 

Macros

#define DECLARE_ENUM(EnumType)
 Helper macros used to create the static data and methods needed to enumerate an EnumerationString. More...
 
#define IMPLEMENT_ENUM(EnumType)
 A macro that defines implement enum. More...
 

Functions

TR_UTIL_EXPORT std::ostream & trUtil::operator<< (std::ostream &os, const EnumerationString &e)
 Helper method to print EnumerationNumeric to an output stream. More...
 

Macro Definition Documentation

◆ DECLARE_ENUM

#define DECLARE_ENUM (   EnumType)
Value:
public: \
using EnumerateListType = std::vector<EnumType*>; \
\
static const EnumerateListType& EnumerateType() \
{ \
return EnumType::mInstances; \
} \
\
static const std::vector<trUtil::EnumerationString*>& Enumerate() \
{ \
return EnumType::mGenericInstances; \
} \
\
static EnumType* GetValueForName(const std::string& name); \
\
private: \
static EnumerateListType mInstances; \
static std::vector<trUtil::EnumerationString*> mGenericInstances; \
static void AddInstance(EnumType* instance); \
public:

Helper macros used to create the static data and methods needed to enumerate an EnumerationString.

Parameters
EnumTypeType of the enum.

Definition at line 255 of file EnumerationString.h.

◆ IMPLEMENT_ENUM

#define IMPLEMENT_ENUM (   EnumType)
Value:
EnumType::EnumerateListType EnumType::mInstances; \
std::vector<trUtil::EnumerationString*> EnumType::mGenericInstances; \
void EnumType::AddInstance(EnumType* instance) \
{ \
EnumType::mInstances.push_back(instance); \
EnumType::mGenericInstances.push_back(instance); \
} \
EnumType* EnumType::GetValueForName(const std::string& name) \
{ \
for (unsigned i = 0; i < mInstances.size(); ++i) \
{ \
if ((*mInstances[i]) == name) \
{ \
return mInstances[i]; \
} \
} \
return nullptr; \
}

A macro that defines implement enum.

Parameters
EnumTypeType of the enum.

Definition at line 284 of file EnumerationString.h.