aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2016-12-10 19:11:10 +0100
committerShauren <shauren.trinity@gmail.com>2016-12-10 19:11:10 +0100
commitb6f1f8405f57e3b65c3b838ea87141716023bc72 (patch)
tree4c23791a4740b3fe639bad88514b10ddefeb73c6 /src/server
parentbfa9a4c9597c748734836fa2293f1ccf9724dbba (diff)
Core/Misc: Added regex compatibility layer to fall back to boost::regex for really old compiler
Diffstat (limited to 'src/server')
-rw-r--r--src/server/game/DataStores/DB2Stores.cpp16
-rw-r--r--src/server/game/DataStores/DB2Stores.h4
-rw-r--r--src/server/game/Scripting/ScriptReloadMgr.cpp8
3 files changed, 14 insertions, 14 deletions
diff --git a/src/server/game/DataStores/DB2Stores.cpp b/src/server/game/DataStores/DB2Stores.cpp
index d249097273f..70ce1a35d2c 100644
--- a/src/server/game/DataStores/DB2Stores.cpp
+++ b/src/server/game/DataStores/DB2Stores.cpp
@@ -741,7 +741,7 @@ void DB2Manager::LoadStores(std::string const& dataPath, uint32 defaultLocale)
std::wstring name;
ASSERT(Utf8toWStr(namesProfanity->Name, name));
if (namesProfanity->Language != -1)
- _nameValidators[namesProfanity->Language].emplace_back(name, std::regex::icase | std::regex::optimize);
+ _nameValidators[namesProfanity->Language].emplace_back(name, Trinity::regex::icase | Trinity::regex::optimize);
else
{
for (uint32 i = 0; i < TOTAL_LOCALES; ++i)
@@ -749,7 +749,7 @@ void DB2Manager::LoadStores(std::string const& dataPath, uint32 defaultLocale)
if (i == LOCALE_none)
continue;
- _nameValidators[i].emplace_back(name, std::regex::icase | std::regex::optimize);
+ _nameValidators[i].emplace_back(name, Trinity::regex::icase | Trinity::regex::optimize);
}
}
}
@@ -758,7 +758,7 @@ void DB2Manager::LoadStores(std::string const& dataPath, uint32 defaultLocale)
{
std::wstring name;
ASSERT(Utf8toWStr(namesReserved->Name, name));
- _nameValidators[TOTAL_LOCALES].emplace_back(name, std::regex::icase | std::regex::optimize);
+ _nameValidators[TOTAL_LOCALES].emplace_back(name, Trinity::regex::icase | Trinity::regex::optimize);
}
for (NamesReservedLocaleEntry const* namesReserved : sNamesReservedLocaleStore)
@@ -772,7 +772,7 @@ void DB2Manager::LoadStores(std::string const& dataPath, uint32 defaultLocale)
continue;
if (namesReserved->LocaleMask & (1 << i))
- _nameValidators[i].emplace_back(name, std::regex::icase | std::regex::optimize);
+ _nameValidators[i].emplace_back(name, Trinity::regex::icase | Trinity::regex::optimize);
}
}
@@ -1580,13 +1580,13 @@ std::string DB2Manager::GetNameGenEntry(uint8 race, uint8 gender, LocaleConstant
ResponseCodes DB2Manager::ValidateName(std::wstring const& name, LocaleConstant locale) const
{
- for (std::wregex const& regex : _nameValidators[locale])
- if (std::regex_search(name, regex))
+ for (Trinity::wregex const& regex : _nameValidators[locale])
+ if (Trinity::regex_search(name, regex))
return CHAR_NAME_PROFANE;
// regexes at TOTAL_LOCALES are loaded from NamesReserved which is not locale specific
- for (std::wregex const& regex : _nameValidators[TOTAL_LOCALES])
- if (std::regex_search(name, regex))
+ for (Trinity::wregex const& regex : _nameValidators[TOTAL_LOCALES])
+ if (Trinity::regex_search(name, regex))
return CHAR_NAME_RESERVED;
return CHAR_NAME_SUCCESS;
diff --git a/src/server/game/DataStores/DB2Stores.h b/src/server/game/DataStores/DB2Stores.h
index bdcb1ae5b9c..5b1751095b1 100644
--- a/src/server/game/DataStores/DB2Stores.h
+++ b/src/server/game/DataStores/DB2Stores.h
@@ -21,7 +21,7 @@
#include "DB2Store.h"
#include "DB2Structure.h"
#include "SharedDefines.h"
-#include <regex>
+#include "Regex.h"
TC_GAME_API extern DB2Storage<AchievementEntry> sAchievementStore;
TC_GAME_API extern DB2Storage<AnimKitEntry> sAnimKitStore;
@@ -259,7 +259,7 @@ public:
typedef std::set<MountTypeXCapabilityEntry const*, MountTypeXCapabilityEntryComparator> MountTypeXCapabilitySet;
typedef std::unordered_map<uint32, MountTypeXCapabilitySet> MountCapabilitiesByTypeContainer;
typedef std::unordered_map<uint32, std::array<std::vector<NameGenEntry const*>, 2>> NameGenContainer;
- typedef std::array<std::vector<std::wregex>, TOTAL_LOCALES + 1> NameValidationRegexContainer;
+ typedef std::array<std::vector<Trinity::wregex>, TOTAL_LOCALES + 1> NameValidationRegexContainer;
typedef std::unordered_map<uint32, std::set<uint32>> PhaseGroupContainer;
typedef std::array<PowerTypeEntry const*, MAX_POWERS> PowerTypesContainer;
typedef std::unordered_map<uint32, std::pair<std::vector<QuestPackageItemEntry const*>, std::vector<QuestPackageItemEntry const*>>> QuestPackageItemContainer;
diff --git a/src/server/game/Scripting/ScriptReloadMgr.cpp b/src/server/game/Scripting/ScriptReloadMgr.cpp
index b0c9b6821d2..07cfba8408f 100644
--- a/src/server/game/Scripting/ScriptReloadMgr.cpp
+++ b/src/server/game/Scripting/ScriptReloadMgr.cpp
@@ -308,12 +308,12 @@ Optional<std::shared_ptr<ScriptModule>>
static bool HasValidScriptModuleName(std::string const& name)
{
// Detects scripts_NAME.dll's / .so's
- static std::regex const regex(
+ static Trinity::regex const regex(
Trinity::StringFormat("^%s[sS]cripts_[a-zA-Z0-9_]+\\.%s$",
GetSharedLibraryPrefix(),
GetSharedLibraryExtension()));
- return std::regex_match(name, regex);
+ return Trinity::regex_match(name, regex);
}
/// File watcher responsible for watching shared libraries
@@ -1529,8 +1529,8 @@ void LibraryUpdateListener::handleFileAction(efsw::WatchID watchid, std::string
/// Returns true when the given path has a known C++ file extension
static bool HasCXXSourceFileExtension(fs::path const& path)
{
- static std::regex const regex("^\\.(h|hpp|c|cc|cpp)$");
- return std::regex_match(path.extension().generic_string(), regex);
+ static Trinity::regex const regex("^\\.(h|hpp|c|cc|cpp)$");
+ return Trinity::regex_match(path.extension().generic_string(), regex);
}
SourceUpdateListener::SourceUpdateListener(fs::path path, std::string script_module_name)