19 #ifndef TRINITYCORE_COMMON_H
20 #define TRINITYCORE_COMMON_H
34 #include <unordered_set>
38 #include <unordered_map>
46 #include <boost/optional.hpp>
47 #include <boost/utility/in_place_factory.hpp>
48 #include <boost/functional/hash.hpp>
54 #if PLATFORM == PLATFORM_WINDOWS
55 # include <ws2tcpip.h>
57 # if defined(__INTEL_COMPILER)
58 # if !defined(BOOST_ASIO_HAS_MOVE)
59 # define BOOST_ASIO_HAS_MOVE
60 # endif // !defined(BOOST_ASIO_HAS_MOVE)
61 # endif // if defined(__INTEL_COMPILER)
64 # include <sys/types.h>
65 # include <sys/ioctl.h>
66 # include <sys/socket.h>
67 # include <netinet/in.h>
72 #if COMPILER == COMPILER_MICROSOFT
76 #define snprintf _snprintf
78 #define vsnprintf _vsnprintf
83 #define stricmp strcasecmp
84 #define strnicmp strncasecmp
88 inline float finiteAlways(
float f) {
return std::isfinite(f) ? f : 0.0f; }
90 inline unsigned long atoul(
char const* str) {
return strtoul(str,
nullptr, 10); }
91 inline unsigned long long atoull(
char const* str) {
return strtoull(str,
nullptr, 10); }
93 #define STRINGIZE(a) #a
134 #define DEFAULT_LOCALE LOCALE_enUS
136 #define MAX_LOCALES 11
144 #pragma pack(push, 1)
163 #define M_PI 3.14159265358979323846
166 #define MAX_QUERY_LEN 32*1024
169 template <
typename T>
175 template<
typename T,
typename ...Args>
178 return std::unique_ptr<T>(
new T(std::forward<Args>(args)...));
186 template<
class K,
class V>
192 return boost::hash_value(key);
TC_COMMON_API LocaleConstant GetLocaleByName(const std::string &name)
Definition: Common.cpp:37
unsigned long long atoull(char const *str)
Definition: Common.h:91
#define hash
Definition: private_namespace.h:186
std::unique_ptr< T > make_unique(Args &&...args)
std::make_unique implementation (TODO: remove this once C++14 is supported)
Definition: Common.h:176
const uint8 OLD_TOTAL_LOCALES
Definition: Common.h:133
TC_COMMON_API char const * localeNames[TOTAL_LOCALES]
Definition: Common.h:138
size_t operator()(std::pair< K, V > const &key) const
Definition: Common.h:190
TimeConstants
Definition: Common.h:95
unsigned long atoul(char const *str)
Definition: Common.h:90
LocaleConstant
Definition: Common.h:115
AccountTypes
Definition: Common.h:106
boost::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Common.h:170
#define TC_COMMON_API
Definition: Define.h:116
float finiteAlways(float f)
Definition: Common.h:88
std::vector< std::string > StringVector
Definition: Common.h:142
uint8_t uint8
Definition: Define.h:152