TrinityCore
Loading...
Searching...
No Matches
PlayerNameMapHolder Namespace Reference

Typedefs

typedef std::unordered_map< std::string, Player * > MapType
 

Functions

void Insert (Player *p)
 
void Remove (Player *p)
 
PlayerFind (std::string_view name)
 

Variables

static MapType PlayerNameMap
 

Typedef Documentation

◆ MapType

typedef std::unordered_map<std::string, Player*> PlayerNameMapHolder::MapType

Definition at line 77 of file ObjectAccessor.cpp.

Function Documentation

◆ Find()

Player * PlayerNameMapHolder::Find ( std::string_view  name)

Definition at line 90 of file ObjectAccessor.cpp.

91 {
92 std::string charName(name);
93 if (!normalizePlayerName(charName))
94 return nullptr;
95
96 auto itr = PlayerNameMap.find(charName);
97 return (itr != PlayerNameMap.end()) ? itr->second : nullptr;
98 }
bool normalizePlayerName(std::string &name)
Definition: ObjectMgr.cpp:161
static MapType PlayerNameMap
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Insert()

void PlayerNameMapHolder::Insert ( Player p)

Definition at line 80 of file ObjectAccessor.cpp.

81 {
82 PlayerNameMap[p->GetName()] = p;
83 }
std::string const & GetName() const
Definition: Object.h:536
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Remove()

void PlayerNameMapHolder::Remove ( Player p)

Definition at line 85 of file ObjectAccessor.cpp.

86 {
87 PlayerNameMap.erase(p->GetName());
88 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ PlayerNameMap

MapType PlayerNameMapHolder::PlayerNameMap
static

Definition at line 78 of file ObjectAccessor.cpp.