TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Common.h File Reference
#include "Define.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <cmath>
#include <errno.h>
#include <signal.h>
#include <assert.h>
#include <set>
#include <unordered_set>
#include <list>
#include <string>
#include <map>
#include <unordered_map>
#include <queue>
#include <sstream>
#include <algorithm>
#include <memory>
#include <vector>
#include <array>
#include <boost/optional.hpp>
#include <boost/utility/in_place_factory.hpp>
#include <boost/functional/hash.hpp>
#include "Debugging/Errors.h"
#include "Threading/LockedQueue.h"
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include <netdb.h>
#include <float.h>
+ Include dependency graph for Common.h:

Go to the source code of this file.

Classes

struct  LocalizedString
 
struct  std::hash< std::pair< K, V > >
 

Namespaces

 Trinity
 

Macros

#define snprintf   _snprintf
 
#define atoll   _atoi64
 
#define vsnprintf   _vsnprintf
 
#define llabs   _abs64
 
#define STRINGIZE(a)   #a
 
#define DEFAULT_LOCALE   LOCALE_enUS
 
#define MAX_LOCALES   11
 
#define M_PI   3.14159265358979323846
 
#define MAX_QUERY_LEN   32*1024
 

Typedefs

typedef std::vector< std::string > StringVector
 
template<typename T >
using Optional = boost::optional< T >
 Optional helper class to wrap optional values within. More...
 

Enumerations

enum  TimeConstants {
  MINUTE = 60, HOUR = MINUTE*60, DAY = HOUR*24, WEEK = DAY*7,
  MONTH = DAY*30, YEAR = MONTH*12, IN_MILLISECONDS = 1000
}
 
enum  AccountTypes {
  SEC_PLAYER = 0, SEC_MODERATOR = 1, SEC_GAMEMASTER = 2, SEC_ADMINISTRATOR = 3,
  SEC_CONSOLE = 4
}
 
enum  LocaleConstant {
  LOCALE_enUS = 0, LOCALE_koKR = 1, LOCALE_frFR = 2, LOCALE_deDE = 3,
  LOCALE_zhCN = 4, LOCALE_zhTW = 5, LOCALE_esES = 6, LOCALE_esMX = 7,
  LOCALE_ruRU = 8, LOCALE_none = 9, LOCALE_ptBR = 10, LOCALE_itIT = 11,
  TOTAL_LOCALES
}
 

Functions

float finiteAlways (float f)
 
unsigned long atoul (char const *str)
 
unsigned long long atoull (char const *str)
 
TC_COMMON_API LocaleConstant GetLocaleByName (const std::string &name)
 
template<typename T , typename... Args>
std::unique_ptr< T > Trinity::make_unique (Args &&...args)
 std::make_unique implementation (TODO: remove this once C++14 is supported) More...
 

Variables

const uint8 OLD_TOTAL_LOCALES = 9
 
TC_COMMON_API char constlocaleNames [TOTAL_LOCALES]
 

Macro Definition Documentation

#define atoll   _atoi64
#define DEFAULT_LOCALE   LOCALE_enUS
Todo:
convert in simple system
#define llabs   _abs64
#define M_PI   3.14159265358979323846
#define MAX_LOCALES   11
#define MAX_QUERY_LEN   32*1024
#define snprintf   _snprintf
#define STRINGIZE (   a)    #a
#define vsnprintf   _vsnprintf

Typedef Documentation

template<typename T >
using Optional = boost::optional<T>

Optional helper class to wrap optional values within.

typedef std::vector<std::string> StringVector

Enumeration Type Documentation

Enumerator
SEC_PLAYER 
SEC_MODERATOR 
SEC_GAMEMASTER 
SEC_ADMINISTRATOR 
SEC_CONSOLE 
107 {
108  SEC_PLAYER = 0,
109  SEC_MODERATOR = 1,
110  SEC_GAMEMASTER = 2,
111  SEC_ADMINISTRATOR = 3,
112  SEC_CONSOLE = 4 // must be always last in list, accounts must have less security level always also
113 };
Definition: Common.h:111
Definition: Common.h:108
Definition: Common.h:110
Definition: Common.h:109
Definition: Common.h:112
Enumerator
LOCALE_enUS 
LOCALE_koKR 
LOCALE_frFR 
LOCALE_deDE 
LOCALE_zhCN 
LOCALE_zhTW 
LOCALE_esES 
LOCALE_esMX 
LOCALE_ruRU 
LOCALE_none 
LOCALE_ptBR 
LOCALE_itIT 
TOTAL_LOCALES 
116 {
117  LOCALE_enUS = 0,
118  LOCALE_koKR = 1,
119  LOCALE_frFR = 2,
120  LOCALE_deDE = 3,
121  LOCALE_zhCN = 4,
122  LOCALE_zhTW = 5,
123  LOCALE_esES = 6,
124  LOCALE_esMX = 7,
125  LOCALE_ruRU = 8,
126  LOCALE_none = 9,
127  LOCALE_ptBR = 10,
128  LOCALE_itIT = 11,
129 
131 };
Definition: Common.h:126
Definition: Common.h:121
Definition: Common.h:118
Definition: Common.h:119
Definition: Common.h:127
Definition: Common.h:117
Definition: Common.h:124
Definition: Common.h:123
Definition: Common.h:120
Definition: Common.h:122
Definition: Common.h:125
Definition: Common.h:128
Definition: Common.h:130
Enumerator
MINUTE 
HOUR 
DAY 
WEEK 
MONTH 
YEAR 
IN_MILLISECONDS 
96 {
97  MINUTE = 60,
98  HOUR = MINUTE*60,
99  DAY = HOUR*24,
100  WEEK = DAY*7,
101  MONTH = DAY*30,
102  YEAR = MONTH*12,
103  IN_MILLISECONDS = 1000
104 };
Definition: Common.h:98
Definition: Common.h:102
Definition: Common.h:101
Definition: Common.h:97
Definition: Common.h:99
Definition: Common.h:100
Definition: Common.h:103

Function Documentation

unsigned long atoul ( char const str)
inline
90 { return strtoul(str, nullptr, 10); }

+ Here is the caller graph for this function:

unsigned long long atoull ( char const str)
inline
91 { return strtoull(str, nullptr, 10); }

+ Here is the caller graph for this function:

float finiteAlways ( float  f)
inline
88 { return std::isfinite(f) ? f : 0.0f; }
TC_COMMON_API LocaleConstant GetLocaleByName ( const std::string &  name)
38 {
39  for (uint32 i = 0; i < TOTAL_LOCALES; ++i)
40  if (name == localeNames[i])
41  return LocaleConstant(i);
42 
43  return LOCALE_enUS; // including enGB case
44 }
LocaleConstant
Definition: Common.h:115
uint32_t uint32
Definition: Define.h:150
TC_COMMON_API char const * localeNames[TOTAL_LOCALES]
Definition: Common.cpp:21
Definition: Common.h:117
Definition: Common.h:130

+ Here is the caller graph for this function:

Variable Documentation

TC_COMMON_API char const* localeNames[TOTAL_LOCALES]
const uint8 OLD_TOTAL_LOCALES = 9