|
Player12
An open source football management simulator
|
First and last names from assets/user_made_data/names_files. More...
#include <world_generation.h>
Public Member Functions | |
| bool | isExcluded (std::string_view full_name) const |
| const std::vector< std::string > & | firstNames (Language nationality) const |
| const std::vector< std::string > & | lastNames (Language nationality) const |
Static Public Member Functions | |
| static std::string | normalizeName (std::string_view name) |
| static std::uint64_t | nameHash (std::string_view name) |
| static const NamePool & | instance () |
Public Attributes | |
| std::vector< std::string > | first_names |
| std::vector< std::string > | last_names |
| std::unordered_map< Language, std::vector< std::string > > | first_by_nationality |
| std::unordered_map< Language, std::vector< std::string > > | last_by_nationality |
| std::unordered_set< std::uint64_t > | excluded_name_hashes |
First and last names from assets/user_made_data/names_files.
Besides a generic list, every nationality has its own fictional but culture-appropriate names. Full names listed (as hashes) under "excluded_name_hashes" are never generated.
| const std::vector< std::string > & NamePool::firstNames | ( | Language | nationality | ) | const |
First names of nationality (the generic list if it has none).
|
static |
Loads the name files once and returns the shared pool.
| bool NamePool::isExcluded | ( | std::string_view | full_name | ) | const |
True when full_name is on the excluded list.
| const std::vector< std::string > & NamePool::lastNames | ( | Language | nationality | ) | const |
Last names of nationality (the generic list if it has none).
|
static |
Salted 64-bit FNV-1a hash of normalizeName(name).
|
static |
Comparable form of a name: lower case ASCII, Latin accents and ligatures folded (e.g. "Ø" -> "o", "ß" -> "ss"), whitespace collapsed to single spaces and trimmed.
| std::unordered_set<std::uint64_t> NamePool::excluded_name_hashes |
nameHash() of every full name that must never be generated.
| std::unordered_map<Language, std::vector<std::string> > NamePool::first_by_nationality |
| std::vector<std::string> NamePool::first_names |
| std::unordered_map<Language, std::vector<std::string> > NamePool::last_by_nationality |
| std::vector<std::string> NamePool::last_names |