C/C++ API Reference
Loading...
Searching...
No Matches
pw_enum

Overview

Automatic versioned tokenized enum support.

Main docs: Home

Namespaces

namespace  pw
 The Pigweed namespace.
 

Macros

#define PW_ENUM(enum_name, ...)
 

Macro Definition Documentation

◆ PW_ENUM

#define PW_ENUM (   enum_name,
  ... 
)
Value:
static_assert(false, \
"PW_ENUM(" #enum_name \
") must be compiled with a pw_cc_enum target!"); \
_PW_ENUM_MUST_BE_COMPILED_BY_pw_cc_enum( \
#enum_name, \
PW_APPLY(_PW_ENUM_STRINGIFY_ARG, _PW_ENUM_COMMA, unused, __VA_ARGS__)) \
_PW_ENUM_MACRO_END
#define PW_APPLY(macro, separator, forwarded_arg,...)
Definition: apply.h:37

Registers a C++ enum for automatic stringification and tokenization.

This macro must be called at the global scope (outside of any namespaces, classes, or functions).

Parameters
enum_nameThe fully-qualified C++ enum name (e.g., my_ns::MyEnum).
...The enumerator names to register. By default, Google-style kCamelCase names are converted to UPPER_SNAKE_CASE without the k prefix. A custom display name can be specified with kEnum = "custom". If multiple enumerators share the same value (aliases), they are grouped and their names are joined (e.g., "A|B").