MRDOCS_ENUM_ENTRY

Emit the describe entry for one enumerator.

Synopsis

#define MRDOCS_ENUM_ENTRY(E, e)

Description

Use it between MRDOCS_DESCRIBE_ENUM_BEGIN and MRDOCS_DESCRIBE_ENUM_END, usually by pointing the X‐macro INFO at it before including the .inc file that lists the enumerators:

MRDOCS_DESCRIBE_ENUM_BEGIN(ShapeKind)
#define INFO(Name) MRDOCS_ENUM_ENTRY(ShapeKind, Name)
#include "ShapeNodes.inc"
MRDOCS_DESCRIBE_ENUM_END(ShapeKind)

You can also write the entries by hand:

enum class Dir { Up, Down };

MRDOCS_DESCRIBE_ENUM_BEGIN(Dir)
MRDOCS_ENUM_ENTRY(Dir, Up)
MRDOCS_ENUM_ENTRY(Dir, Down)
MRDOCS_DESCRIBE_ENUM_END(Dir)

Each entry is one comma‐prefixed descriptor argument:

// MRDOCS_ENUM_ENTRY(Dir, Up)
, ::mrdocs::describe::detail::enum_descriptor<
    Dir::Up, []{ return "Up"; }>{}
// The descriptor's `value` is Dir::Up and its `name` is "Up".

The leading comma is what lets entries follow the 0 that MRDOCS_DESCRIBE_ENUM_BEGIN leaves open, so don't put commas or semicolons between entries. It only makes sense inside that bracket; anywhere else the stray comma is a syntax error.

Parameters

Name

Description

E

The enum type.

e

The enumerator name, written without the E:: prefix.

Created with MrDocs