Gorgon Game Engine
Enum.h File Reference

contains Enum class that allows C++ enums to have string capabilities. More...

Include dependency graph for Enum.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 Gorgon
 Root namespace for Gorgon Game Engine.
 
 Gorgon::String
 Contains string related functions and classes. This namespace is not yet utf8 aware.
 

Macros

#define DefineEnumStrings(type, ...)
 This macro converts a regular C++ enumeration in to an enumerable, stream-able, and parsable enumeration by assigning one or more strings to enum values. More...
 
#define DefineEnumStringsCM(clsname, type, ...)
 This macro converts a regular C++ enumeration in to an enumerable, stream-able, and parsable enumeration by assigning one or more strings to enum values. More...
 
#define DefineEnumStringsCMTN(clsname, type, typname, ...)
 This macro converts a regular C++ enumeration in to an enumerable, stream-able, and parsable enumeration by assigning one or more strings to enum values. More...
 
#define DefineEnumStringsTN(type, typname, ...)
 This macro converts a regular C++ enumeration in to an enumerable, stream-able, and parsable enumeration by assigning one or more strings to enum values. More...
 

Functions

template<class T_ >
std::vector< T_ >::const_iterator begin (enum_type_id< T_ >)
 
template<class T_ >
std::vector< T_ >::const_iterator end (enum_type_id< T_ >)
 
template<class T_ >
std::enable_if< decltype(gorgon__enum_tr_loc(T_()))::isupgradedenum, enum_type_id< T_ > >::type Enumerate ()
 Allows enumeration of upgraded enums using range based for. More...
 
template<class T_ >
std::enable_if< decltype(gorgon__enum_tr_loc(T_()))::isupgradedenum, std::string >::type From (const T_ &e)
 
template<class T_ >
std::enable_if< decltype(gorgon__enum_tr_loc(T_()))::isupgradedenum, std::istream & >::type getline (std::istream &in, T_ &e)
 Stream reader for upgraded enums. More...
 
template<class T_ >
gorgon__no_enum_trait gorgon__enum_tr_loc (T_)
 
template<class T_ >
std::enable_if< decltype(gorgon__enum_tr_loc(T_()))::isupgradedenum, std::ostream & >::type operator<< (std::ostream &out, const T_ &e)
 Stream writer for upgraded enums. More...
 
template<class T_ >
std::enable_if< decltype(gorgon__enum_tr_loc(T_()))::isupgradedenum, std::istream & >::type operator>> (std::istream &in, T_ &e)
 Stream reader for upgraded enums. More...
 
template<class T_ >
std::enable_if< decltype(gorgon__enum_tr_loc(T_()))::isupgradedenum, T_ >::type Parse (const std::string &text)
 
template<class T_ >
std::enable_if< decltype(gorgon__enum_tr_loc(T_()))::isupgradedenum, T_ >::type To (const std::string &text)
 

Detailed Description

contains Enum class that allows C++ enums to have string capabilities.

Macro Definition Documentation

◆ DefineEnumStrings

#define DefineEnumStrings (   type,
  ... 
)

This macro converts a regular C++ enumeration in to an enumerable, stream-able, and parsable enumeration by assigning one or more strings to enum values.

This macro should be invoked in the same namespace as the original enumeration. Type cannot contain any scope resolution operators. This means that class member enums cannot be used with this macro. DefineEnumStringsTN macro supports class member enums. First parameter is the enum type which should be followed by enum value - name pairs.

See also
Enum
Enumerate
Parse

◆ DefineEnumStringsCM

#define DefineEnumStringsCM (   clsname,
  type,
  ... 
)

This macro converts a regular C++ enumeration in to an enumerable, stream-able, and parsable enumeration by assigning one or more strings to enum values.

This macro should be invoked in the same namespace as the original enumeration. This variant allows class member enumerations. The first parameter should be class name, second parameter is the type, after these parameters, value name pairs should be added. Use DefineEnumStringsCMTN to set custom typename

See also
Enum
Enumerate
Parse

◆ DefineEnumStringsCMTN

#define DefineEnumStringsCMTN (   clsname,
  type,
  typname,
  ... 
)

This macro converts a regular C++ enumeration in to an enumerable, stream-able, and parsable enumeration by assigning one or more strings to enum values.

This macro should be invoked in the same namespace as the original enumeration. This variant allows class member enumerations. This variant allows class member enumerations and custom readable typename.
The first parameter should be class name, second is the type and third is the readable name of the type, after these parameters, value name pairs should be added.

See also
Enumerate
Parse

◆ DefineEnumStringsTN

#define DefineEnumStringsTN (   type,
  typname,
  ... 
)

This macro converts a regular C++ enumeration in to an enumerable, stream-able, and parsable enumeration by assigning one or more strings to enum values.

This macro should be invoked in the same namespace as the original enumeration. Type cannot contain any scope resolution operators. This means that class member enums cannot be used with this macro. DefineEnumStringsCMTN macro supports class member enums. This variant allows modification of readable typename. First parameter is the enum type, second is the name for the type and the rest of the parameters are the enum value - name pairs

See also
Enum
Enumerate
Parse

Function Documentation

◆ getline()

std::enable_if<decltype(gorgon__enum_tr_loc(T_()))::isupgradedenum, std::istream&>::type std::getline ( std::istream &  in,
T_ &  e 
)

Stream reader for upgraded enums.

References std::getline(), and Gorgon::Graphics::internal::isspace().

◆ gorgon__enum_tr_loc()

gorgon__no_enum_trait gorgon__enum_tr_loc ( T_  )

◆ operator<<()

std::enable_if<decltype(gorgon__enum_tr_loc(T_()))::isupgradedenum, std::ostream&>::type operator<< ( std::ostream &  out,
const T_ &  e 
)

Stream writer for upgraded enums.

◆ operator>>()

std::enable_if<decltype(gorgon__enum_tr_loc(T_()))::isupgradedenum, std::istream&>::type operator>> ( std::istream &  in,
T_ &  e 
)

Stream reader for upgraded enums.