Defined in <plugin/PluginRegister.hh>.
#define REGISTERAS( NAME, CLASS, BASE ) // key is "NAME" (stringised token)
#define REGISTERBYNICK( CNAME, CLASS, BASE ) // key is CNAME (an expression)
Both add another catalog entry for CLASS and pass copy = true to PluginRegisterer, so the resulting Creator reports isAlias() == true.
The only behavioural difference from a primary registration: PluginCatalog::names() omits aliases unless called as names(true). create(), contains() and size() treat an alias like any other key.
REGISTERAS vs REGISTERBYNICK
| Key argument | Example | Resulting key | |
|---|---|---|---|
REGISTERAS | a bare token, stringised with # | REGISTERAS( oval, Ellipse, Shape ) | "oval" |
REGISTERBYNICK | any const char* expression | REGISTERBYNICK( "◯", Ellipse, Shape ) | "◯" |
Use REGISTERBYNICK when the key is not a valid identifier — punctuation, Unicode, a string built from a macro.
Example
// Ellipse.cpp
REGISTER_WITH_CONFIG( Ellipse, Shape, Ellipse::Config ); // primary: "Ellipse"
REGISTERAS( oval, Ellipse, Shape ); // alias: "oval"
REGISTERBYNICK( "⬭", Ellipse, Shape ); // alias: "⬭"
Shape::create( "Ellipse" ); // ok
Shape::create( "oval" ); // ok — same class (default ctor; aliases have no config factory)
Shape::create( "⬭" ); // ok
Shape::catalog().names(); // { "Ellipse", ... } — aliases hidden
Shape::catalog().names(true); // { "Ellipse", "oval", "⬭", ... }
Notes
- Aliases register the default factory only.
REGISTERAS/REGISTERBYNICKbuild aPluginRegisterer(not...WithConfig), socreate("oval", cfg)throwsstd::runtime_error. Call the primary key for config construction. - Each alias is its own file-scope object with its own erase-on-unload, so all of a class's keys disappear together when the DSO unloads.
- Typical uses: a backward-compatible old name after a rename, a short form, a display glyph.

