MRDOCS_KIND_ENTRY

Emit the describe entry for one derived kind.

Synopsis

#define MRDOCS_KIND_ENTRY(C, D)

Description

Use it between MRDOCS_DESCRIBE_KINDS_BEGIN and MRDOCS_DESCRIBE_KINDS_END, one per derived class. Usually the X‐macro INFO points at it, so an .inc file with one INFO(Name) per kind supplies the entries:

#define INFO(Name) MRDOCS_KIND_ENTRY(Shape, Name##Shape)
MRDOCS_DESCRIBE_KINDS_BEGIN(Shape)
#include "ShapeNodes.inc"
MRDOCS_DESCRIBE_KINDS_END(Shape)

You can also write the entries by hand:

struct Node { int Kind; };
struct Leaf : Node {};
struct Branch : Node {};

MRDOCS_DESCRIBE_KINDS_BEGIN(Node)
    MRDOCS_KIND_ENTRY(Node, Leaf)
    MRDOCS_KIND_ENTRY(Node, Branch)
MRDOCS_DESCRIBE_KINDS_END(Node)

Each entry is a leading comma plus a descriptor object, which becomes one more argument of the call that MRDOCS_DESCRIBE_KINDS_BEGIN opens:

// MRDOCS_KIND_ENTRY(Node, Leaf) expands to exactly:
, ::mrdocs::describe::detail::kind_descriptor<Node, Leaf>{}

Because of that leading comma it only makes sense in that spot. Don't put a ; after it, and don't use it with MRDOCS_DESCRIBE_KINDS, which writes its own entries. D may still be a forward declaration here.

Parameters

Name

Description

C

The polymorphic base class, the same one passed to MRDOCS_DESCRIBE_KINDS_BEGIN.

D

The derived class.

Created with MrDocs