SmartEnumCore

Members forming the core of each class generated by the SmartEnum mixin. This template is mixed into each class created by the SmartEnum template.

Public Imports

ocean.meta.types.Qualifiers
public import ocean.meta.types.Qualifiers;

Members

Aliases

opBinaryRight
alias opBinaryRight(istring op : "in") = description
Undocumented in source.
opBinaryRight
alias opBinaryRight(istring op : "in") = code
Undocumented in source.

Static functions

code
BaseType* code(cstring description)

Looks up the code of a description.

codeFromIndex
BaseType codeFromIndex(size_t index)

Looks up a code in the enum by its index. (ie gets the nth code in the enum).

description
istring* description(BaseType code)

Looks up the description of a code.

descriptionFromIndex
istring descriptionFromIndex(size_t index)

Looks up a description in the enum by the index of its code. (ie gets the description of the nth code in the enum).

indexOf
size_t* indexOf(BaseType code)

Looks up the index of a code in the enum (ie code is the nth code in the enum). This can be useful if the actual enum codes are not consecutive.

indexOf
size_t* indexOf(cstring description)

Looks up the index of a description in the enum (ie description is for the nth code in the enum).

opApply
int opApply(int delegate(ref BaseType code, ref istring desc) dg)

foreach iterator over the codes and descriptions of the enum.

opApply
int opApply(int delegate(ref size_t index, ref BaseType code, ref istring desc) dg)

foreach iterator over the codes and descriptions of the enum and their indices.

opIndex
istring opIndex(BaseType code)

Gets the description of a code.

opIndex
BaseType opIndex(cstring description)

Gets the code of a description.

Static variables

map
TwoWayMap!(BaseType) map;

Two way mapping between codes <-> descriptions.

Parameters

BaseType

base type of enum

Meta