Scid
4.7.0
|
This class stores the database's names (players, events, sites and rounds). More...
#include <namebase.h>
Public Member Functions | |
void | AddElo (idNumberT id, eloT elo) |
A NameBase stores the max ELO for each player. More... | |
std::pair< errorT, idNumberT > | addName (nameT nt, const char *name, size_t MAX_LEN, idNumberT MAX_ID) |
Add a name (string) to the NameBase. More... | |
void | Clear () |
Frees memory, leaving the object empty. More... | |
std::tuple< decltype(idx_) &, decltype(names_) &, decltype(eloV_) & > | getData () |
eloT | GetElo (idNumberT id) const |
std::vector< idNumberT > | getFirstMatches (nameT nt, const char *str, size_t maxMatches) const |
Get the first few matches of a name prefix. More... | |
const char * | GetName (nameT nt, idNumberT id) const |
Retrieve a name. More... | |
decltype(idx_) const & | getNames () const |
idNumberT | GetNumNames (nameT nt) const |
errorT | FindExactName (nameT nt, const char *str, idNumberT *idPtr) const |
Finds an exact full, case-sensitive name. More... | |
std::vector< uint32_t > | generateHashMap (nameT nt) const |
For every name generates a 32bit hash with the first 4 chars. More... | |
Static Public Member Functions | |
static bool | IsValidNameType (nameT nt) |
Validate a nameT type. More... | |
static nameT | NameTypeFromString (const char *str) |
Match a string to a nameT. More... | |
This class stores the database's names (players, events, sites and rounds).
Assigns a idNumberT (which will be used as reference) to each name.
Definition at line 33 of file namebase.h.
A NameBase stores the max ELO for each player.
This functions updates the max ELO of a player if it's greater than the previous one.
id | a valid idNumberT corresponding to a NAME_PLAYER name. |
elo | the ELO. |
Definition at line 64 of file namebase.h.
|
inline |
Add a name (string) to the NameBase.
If the name already exists the corresponding ID is returned.
nt | nameT type of the name to add. |
name | the name to add. |
MAX_LEN | the max length for names of type nt |
MAX_ID | the max ID allowed for names of type nt |
Definition at line 81 of file namebase.h.
|
inline |
Frees memory, leaving the object empty.
Definition at line 112 of file namebase.h.
Finds an exact full, case-sensitive name.
nt | nameT type of the name to be searched. | |
str | name to be be searched. | |
[out] | idPtr | pointer which will receive the ID of the name. |
Definition at line 190 of file namebase.h.
|
inline |
For every name generates a 32bit hash with the first 4 chars.
nt | nameT type of the names. |
Definition at line 206 of file namebase.h.
|
inline |
Definition at line 119 of file namebase.h.
id | a valid idNumberT corresponding to a NAME_PLAYER name. |
Definition at line 128 of file namebase.h.
|
inline |
Get the first few matches of a name prefix.
nt | nameT type of the name to be searched. |
str | name prefix be searched. |
maxMatches | the max number of ID to return |
Definition at line 140 of file namebase.h.
Retrieve a name.
nt | the valid nameT type of the name to retrieve. |
id | the valid ID of the name to retrieve. |
Definition at line 162 of file namebase.h.
|
inline |
Definition at line 171 of file namebase.h.
nt | a valid nameT type. |
Definition at line 178 of file namebase.h.
|
inlinestatic |
Validate a nameT type.
nt | nameT type to be validated. |
Definition at line 220 of file namebase.h.
|
inlinestatic |
Match a string to a nameT.
To match, the string should be a prefix of "player", "event", "site" or "round", or be a superstring of it, e.g. "player ...."
str | the string to be matched. |
Definition at line 229 of file namebase.h.