AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Common.cpp File Reference
#include "Common.h"

Go to the source code of this file.

Functions

bool IsLocaleValid (std::string const &locale)
 
LocaleConstant GetLocaleByName (const std::string &name)
 
const std::string GetNameByLocaleConstant (LocaleConstant localeConstant)
 
void CleanStringForMysqlQuery (std::string &str)
 

Variables

char const * localeNames [TOTAL_LOCALES]
 

Function Documentation

◆ CleanStringForMysqlQuery()

void CleanStringForMysqlQuery ( std::string &  str)
62{
63 std::string::size_type n = 0;
64 while ((n = str.find('\\')) != str.npos) { str.erase(n, 1); }
65 while ((n = str.find('"')) != str.npos) { str.erase(n, 1); }
66 while ((n = str.find('\'')) != str.npos) { str.erase(n, 1); }
67}

Referenced by WorldSession::HandleMailTakeItem(), WorldSession::HandleSendMail(), and Map::LogEncounterFinished().

◆ GetLocaleByName()

◆ GetNameByLocaleConstant()

const std::string GetNameByLocaleConstant ( LocaleConstant  localeConstant)
52{
53 if (localeConstant < TOTAL_LOCALES)
54 {
55 return localeNames[localeConstant];
56 }
57
58 return "enUS"; // Default value for unsupported or invalid LocaleConstant
59}

References localeNames, and TOTAL_LOCALES.

Referenced by server_commandscript::HandleServerMotdCommand().

◆ IsLocaleValid()

bool IsLocaleValid ( std::string const &  locale)
34{
35 for (int i = 0; i < TOTAL_LOCALES; ++i)
36 if (locale == localeNames[i])
37 return true;
38
39 return false;
40}

References localeNames, and TOTAL_LOCALES.

Referenced by server_commandscript::HandleServerSetMotdCommand(), and MotdMgr::LoadMotdLocale().

Variable Documentation

◆ localeNames