![]() |
Name Generator 4.2.1
Culture-aware name generation for C++23
|
Return type for name generation, holding both individual parts and the full composed string. More...
#include <namegen.hpp>
Public Member Functions | |
| std::uint64_t | seed () const |
| Retrieve the random seed used to generate this name. | |
| const core::seed_signature & | signature () const |
| The seed and the data this name was generated from. | |
| const std::vector< std::wstring > & | parts () const |
| Return the individual parts (names/surnames) as a vector. | |
| name & | append_name () |
| Append a forename to this name, preserving gender and culture. | |
| name & | append_name (culture c) |
| Append a forename of a specific culture. | |
| name & | append_surname () |
| Append a surname to this name, preserving culture. | |
| name & | append_surname (culture c) |
| Append a surname of a specific culture. | |
| void | to_json (core::json_writer &w) const |
Write this name as a JSON object {"name":…,"parts":[…],"gender":…,"culture":…,"signature":{…}}. | |
| std::string | to_json () const |
| This name as a JSON document. | |
| operator std::wstring () const | |
| Implicit conversion to std::wstring. | |
| operator std::vector< std::wstring > () const | |
| Implicit conversion to a vector of name parts. | |
Friends | |
| class | ng |
| std::wostream & | operator<< (std::wostream &wos, const name &n) |
| Stream the name to a wide output stream. | |
Return type for name generation, holding both individual parts and the full composed string.
Supports implicit conversion to std::wstring, streaming via operator<<, chained appending of names and surnames, and JSON output via to_json().
Definition at line 187 of file namegen.hpp.
|
inline |
Append a forename to this name, preserving gender and culture.
The part is drawn from this name's seed and its position, so the same seed and the same appends give the same full name.
*this for chaining. | std::invalid_argument | If no names are loaded for the culture and gender. |
Definition at line 1181 of file namegen.hpp.
Append a forename of a specific culture.
| c | Culture for the appended name. |
*this for chaining. | std::invalid_argument | If no names are loaded for c. |
Definition at line 1187 of file namegen.hpp.
|
inline |
Append a surname to this name, preserving culture.
*this for chaining. | std::invalid_argument | If no surnames are loaded for the culture. |
Definition at line 1193 of file namegen.hpp.
Append a surname of a specific culture.
| c | Culture for the appended surname. |
*this for chaining. | std::invalid_argument | If no surnames are loaded for c. |
Definition at line 1199 of file namegen.hpp.
|
inline |
Implicit conversion to a vector of name parts.
Definition at line 265 of file namegen.hpp.
|
inline |
Implicit conversion to std::wstring.
Definition at line 259 of file namegen.hpp.
|
inline |
Return the individual parts (names/surnames) as a vector.
Definition at line 208 of file namegen.hpp.
|
inline |
Retrieve the random seed used to generate this name.
Definition at line 193 of file namegen.hpp.
|
inline |
The seed and the data this name was generated from.
data is ng::data_hash() at the time of generation. Definition at line 201 of file namegen.hpp.
|
inline |
|
inline |
Write this name as a JSON object {"name":…,"parts":[…],"gender":…,"culture":…,"signature":{…}}.
gender is the gender of the forenames (for a surname, the one append_name() would use) and culture the culture of the first part.
| w | Writer positioned where a value is allowed. |
Definition at line 1205 of file namegen.hpp.
|
friend |
Definition at line 301 of file namegen.hpp.
|
friend |
Stream the name to a wide output stream.
| wos | Output stream. |
| n | Name to stream. |
Definition at line 274 of file namegen.hpp.