aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2016-07-28 08:48:48 +0200
committerjackpoz <giacomopoz@gmail.com>2016-08-02 17:25:33 +0200
commit5e9f5123141e5387365da6b0214a69b0bd2cf74e (patch)
treee0b416c7ae138b7db1e7015dcbd82b9e26eb3086
parentad74638cd661f2373f48513a548f6504e869476a (diff)
Dep: Remove boost regex dependency and replace its uses with std regex (works since gcc 4.9)
(cherry picked from commit 943496e56b648b050ba6e38d83a8161255c1d537) # Conflicts: # src/server/game/DataStores/DB2Stores.cpp # src/server/game/DataStores/DB2Stores.h
-rw-r--r--dep/boost/CMakeLists.txt2
-rw-r--r--src/server/game/DataStores/DBCStores.cpp20
2 files changed, 11 insertions, 11 deletions
diff --git a/dep/boost/CMakeLists.txt b/dep/boost/CMakeLists.txt
index 764953ab587..fc20347c2c8 100644
--- a/dep/boost/CMakeLists.txt
+++ b/dep/boost/CMakeLists.txt
@@ -26,7 +26,7 @@ if(WIN32)
set(Boost_USE_STATIC_RUNTIME OFF)
endif()
-find_package(Boost 1.55 REQUIRED system filesystem thread program_options iostreams regex)
+find_package(Boost 1.55 REQUIRED system filesystem thread program_options iostreams)
# Find if Boost was compiled in C++03 mode because it requires -DBOOST_NO_CXX11_SCOPED_ENUMS
diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp
index 255225c9739..6e15d104de8 100644
--- a/src/server/game/DataStores/DBCStores.cpp
+++ b/src/server/game/DataStores/DBCStores.cpp
@@ -25,7 +25,7 @@
#include "Timer.h"
#include "ObjectDefines.h"
-#include <boost/regex.hpp>
+#include <regex>
#include <map>
typedef std::map<uint16, uint32> AreaFlagByAreaID;
@@ -145,7 +145,7 @@ DBCStorage <MovieEntry> sMovieStore(MovieEntryfmt);
DBCStorage<NamesProfanityEntry> sNamesProfanityStore(NamesProfanityEntryfmt);
DBCStorage<NamesReservedEntry> sNamesReservedStore(NamesReservedEntryfmt);
-typedef std::array<std::vector<boost::regex>, TOTAL_LOCALES> NameValidationRegexContainer;
+typedef std::array<std::vector<std::regex>, TOTAL_LOCALES> NameValidationRegexContainer;
NameValidationRegexContainer NamesProfaneValidators;
NameValidationRegexContainer NamesReservedValidators;
@@ -411,10 +411,10 @@ void LoadDBCStores(const std::string& dataPath)
ASSERT(namesProfanity->Language < TOTAL_LOCALES || namesProfanity->Language == -1);
if (namesProfanity->Language != -1)
- NamesProfaneValidators[namesProfanity->Language].emplace_back(namesProfanity->Name, boost::regex::perl | boost::regex::icase | boost::regex::optimize);
+ NamesProfaneValidators[namesProfanity->Language].emplace_back(namesProfanity->Name, std::regex::icase | std::regex::optimize);
else
for (uint32 i = 0; i < TOTAL_LOCALES; ++i)
- NamesProfaneValidators[i].emplace_back(namesProfanity->Name, boost::regex::perl | boost::regex::icase | boost::regex::optimize);
+ NamesProfaneValidators[i].emplace_back(namesProfanity->Name, std::regex::icase | std::regex::optimize);
}
for (uint32 i = 0; i < sNamesReservedStore.GetNumRows(); ++i)
@@ -425,10 +425,10 @@ void LoadDBCStores(const std::string& dataPath)
ASSERT(namesReserved->Language < TOTAL_LOCALES || namesReserved->Language == -1);
if (namesReserved->Language != -1)
- NamesReservedValidators[namesReserved->Language].emplace_back(namesReserved->Name, boost::regex::perl | boost::regex::icase | boost::regex::optimize);
+ NamesReservedValidators[namesReserved->Language].emplace_back(namesReserved->Name, std::regex::icase | std::regex::optimize);
else
for (uint32 i = 0; i < TOTAL_LOCALES; ++i)
- NamesReservedValidators[i].emplace_back(namesReserved->Name, boost::regex::perl | boost::regex::icase | boost::regex::optimize);
+ NamesReservedValidators[i].emplace_back(namesReserved->Name, std::regex::icase | std::regex::optimize);
}
@@ -1005,13 +1005,13 @@ ResponseCodes ValidateName(std::string const& name, LocaleConstant locale)
if (locale >= TOTAL_LOCALES)
return RESPONSE_FAILURE;
- for (boost::regex const& regex : NamesProfaneValidators[locale])
- if (boost::regex_search(name, regex))
+ for (std::regex const& regex : NamesProfaneValidators[locale])
+ if (std::regex_search(name, regex))
return CHAR_NAME_PROFANE;
// regexes at TOTAL_LOCALES are loaded from NamesReserved which is not locale specific
- for (boost::regex const& regex : NamesReservedValidators[locale])
- if (boost::regex_search(name, regex))
+ for (std::regex const& regex : NamesReservedValidators[locale])
+ if (std::regex_search(name, regex))
return CHAR_NAME_RESERVED;
return CHAR_NAME_SUCCESS;