![]() |
Nickname Generator 1.2.1
Gamer-style nickname generation for C++23
|
Nickname generator that produces gamer-style nicknames. More...
#include <nicknamegen.hpp>
Public Member Functions | |
| nng ()=default | |
| Default constructor — creates an empty generator with no word lists. | |
| nng (const nng &)=delete | |
| Not copyable. | |
| nng & | operator= (const nng &)=delete |
| Not copyable. | |
| nng (nng &&)=default | |
| Move constructor. | |
| nng & | operator= (nng &&)=default |
| Move assignment. | |
| ~nng ()=default | |
| Default destructor. | |
| nickname | get_nickname (const std::wstring &name=L"") |
| Generate a nickname, optionally based on a name. | |
| nickname | get_nickname (const std::wstring &name, std::uint64_t call_seed) const |
| Generate a deterministic nickname using a specific seed. | |
| bool | has_wordlists () const |
| Check whether any word lists have been loaded. | |
| void | load (const std::filesystem::path &resource_path) |
| Load word list files from a directory. | |
Seeding | |
| nng & | seed (std::uint64_t seed_value) |
| Seed the internal random engine for deterministic sequences. | |
| nng & | unseed () |
| Reseed the engine with a non-deterministic source. | |
Static Public Member Functions | |
| static nng & | instance () |
| Access the global singleton instance. | |
Friends | |
| struct | ::nng_test_access |
Nickname generator that produces gamer-style nicknames.
Generates realistic gamer nicknames akin to professional players, optionally based on a player's real name. Applies random "leetifying" transforms and case formatting for variety.
Can be used as a singleton via instance() or constructed independently. Independent instances own their own word lists and random engine, making them safe for concurrent use without shared state.
Definition at line 107 of file nicknamegen.hpp.
|
default |
Default constructor — creates an empty generator with no word lists.
Call load() to populate word lists before generating nicknames.
|
inline |
Generate a deterministic nickname using a specific seed.
Given the same name and seed, this method always produces the same nickname. Retrieve the seed from a previous nickname via nickname::seed().
| name | Full name to base the nickname on (may be empty). |
| call_seed | Seed for reproducible results. |
| std::invalid_argument | If name is empty and no word lists loaded. |
Definition at line 159 of file nicknamegen.hpp.
|
inline |
Generate a nickname, optionally based on a name.
| name | Optional full name to base the nickname on. If empty, a random word from the loaded word lists is used instead. |
| std::invalid_argument | If name is empty and no word lists loaded. |
Definition at line 138 of file nicknamegen.hpp.
|
inline |
Check whether any word lists have been loaded.
true if at least one word list is available. Definition at line 200 of file nicknamegen.hpp.
|
inlinestatic |
Access the global singleton instance.
The singleton auto-probes common resource paths on first access. For independent generators (e.g., inside an entity-generator component), prefer constructing a separate nng instance.
Definition at line 127 of file nicknamegen.hpp.
|
inline |
Load word list files from a directory.
Recursively scans resource_path for .words files and indexes them. Safe to call multiple times to add from different directories.
| resource_path | Directory containing .words files. |
Definition at line 211 of file nicknamegen.hpp.
|
inline |
Seed the internal random engine for deterministic sequences.
Subsequent get_nickname() calls (without an explicit seed) draw per-call seeds from this engine, producing a reproducible sequence.
| seed_value | The seed value. |
*this for chaining. Definition at line 180 of file nicknamegen.hpp.
|
inline |
Reseed the engine with a non-deterministic source.
Subsequent get_nickname() calls will produce non-reproducible results.
*this for chaining. Definition at line 190 of file nicknamegen.hpp.
|
friend |
Definition at line 1045 of file nicknamegen.hpp.