TrinityCore
PlayerDump.cpp File Reference
#include "PlayerDump.h"
#include "AccountMgr.h"
#include "CharacterCache.h"
#include "Common.h"
#include "DatabaseEnv.h"
#include "Log.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "StringConvert.h"
#include "World.h"
#include <boost/algorithm/string/find.hpp>
#include <fstream>
#include <sstream>
+ Include dependency graph for PlayerDump.cpp:

Go to the source code of this file.

Classes

struct  FileCloser
 
struct  BaseTable
 
struct  DumpTable
 
class  StringTransaction
 
struct  TableField
 
struct  TableStruct
 

Typedefs

typedef std::unique_ptr< FILE, FileCloserFileHandle
 

Enumerations

enum  GuidType : uint8 {
  GUID_TYPE_ACCOUNT , GUID_TYPE_MAIL , GUID_TYPE_CHAR , GUID_TYPE_EQUIPMENT_SET ,
  GUID_TYPE_ITEM , GUID_TYPE_PET , GUID_TYPE_NULL
}
 

Functions

FileHandle GetFileHandle (char const *path, char const *mode)
 
bool StringsEqualCaseInsensitive (std::string const &left, std::string const &right)
 
auto FindColumnByName (TableStruct &tableStruct, std::string const &columnName) -> decltype(tableStruct.TableFields.begin())
 
int32 GetColumnIndexByName (TableStruct const &tableStruct, std::string const &columnName)
 
void MarkDependentColumn (TableStruct &tableStruct, std::string const &columnName, GuidType dependentType)
 
void MarkWhereField (TableStruct &tableStruct, std::string const &whereField)
 
void AssertBaseTable (BaseTable const &baseTable)
 
bool FindColumn (TableStruct const &ts, std::string const &str, std::string const &column, std::string::size_type &s, std::string::size_type &e)
 
std::string GetTableName (std::string const &str)
 
bool ValidateFields (TableStruct const &ts, std::string const &str, size_t lineNumber)
 
bool ChangeColumn (TableStruct const &ts, std::string &str, std::string const &column, std::string const &with, bool allowZero=false)
 
std::string GetColumn (TableStruct const &ts, std::string &str, std::string const &column)
 
template<typename T , template< class, class, class... > class MapType, class... Rest>
RegisterNewGuid (T oldGuid, MapType< T, T, Rest... > &guidMap, T guidOffset)
 
template<typename T , template< class, class, class... > class MapType, class... Rest>
bool ChangeGuid (TableStruct const &ts, std::string &str, std::string const &column, MapType< T, T, Rest... > &guidMap, T guidOffset, bool allowZero=false)
 
void AppendTableDump (StringTransaction &trans, TableStruct const &tableStruct, QueryResult result)
 
std::string GenerateWhereStr (std::string const &field, ObjectGuid::LowType guid)
 
template<typename T , template< class, class... > class SetType, class... Rest>
std::string GenerateWhereStr (std::string const &field, SetType< T, Rest... > const &guidSet)
 
void FixNULLfields (std::string &line)
 

Variables

BaseTable const BaseTables []
 
DumpTable const DumpTables []
 
uint32 const DUMP_TABLE_COUNT = std::extent<decltype(DumpTables)>::value
 
std::vector< TableStructCharacterTables
 

Typedef Documentation

◆ FileHandle

typedef std::unique_ptr<FILE, FileCloser> FileHandle

Definition at line 58 of file PlayerDump.cpp.

Enumeration Type Documentation

◆ GuidType

enum GuidType : uint8
Enumerator
GUID_TYPE_ACCOUNT 
GUID_TYPE_MAIL 
GUID_TYPE_CHAR 
GUID_TYPE_EQUIPMENT_SET 
GUID_TYPE_ITEM 
GUID_TYPE_PET 
GUID_TYPE_NULL 

Definition at line 33 of file PlayerDump.cpp.

Function Documentation

◆ AppendTableDump()

void AppendTableDump ( StringTransaction trans,
TableStruct const &  tableStruct,
QueryResult  result 
)
inline

Definition at line 607 of file PlayerDump.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AssertBaseTable()

void AssertBaseTable ( BaseTable const &  baseTable)
inline

Definition at line 268 of file PlayerDump.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ChangeColumn()

bool ChangeColumn ( TableStruct const &  ts,
std::string &  str,
std::string const &  column,
std::string const &  with,
bool  allowZero = false 
)
inline

Definition at line 559 of file PlayerDump.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ChangeGuid()

template<typename T , template< class, class, class... > class MapType, class... Rest>
bool ChangeGuid ( TableStruct const &  ts,
std::string &  str,
std::string const &  column,
MapType< T, T, Rest... > &  guidMap,
guidOffset,
bool  allowZero = false 
)
inline

Definition at line 594 of file PlayerDump.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindColumn()

bool FindColumn ( TableStruct const &  ts,
std::string const &  str,
std::string const &  column,
std::string::size_type &  s,
std::string::size_type &  e 
)
inline

Definition at line 431 of file PlayerDump.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindColumnByName()

auto FindColumnByName ( TableStruct tableStruct,
std::string const &  columnName 
) -> decltype(tableStruct.TableFields.begin())
inline

Definition at line 212 of file PlayerDump.cpp.

+ Here is the caller graph for this function:

◆ FixNULLfields()

void FixNULLfields ( std::string &  line)
inline

Definition at line 853 of file PlayerDump.cpp.

+ Here is the caller graph for this function:

◆ GenerateWhereStr() [1/2]

std::string GenerateWhereStr ( std::string const &  field,
ObjectGuid::LowType  guid 
)
inline

Definition at line 662 of file PlayerDump.cpp.

+ Here is the caller graph for this function:

◆ GenerateWhereStr() [2/2]

template<typename T , template< class, class... > class SetType, class... Rest>
std::string GenerateWhereStr ( std::string const &  field,
SetType< T, Rest... > const &  guidSet 
)
inline

Definition at line 670 of file PlayerDump.cpp.

◆ GetColumn()

std::string GetColumn ( TableStruct const &  ts,
std::string &  str,
std::string const &  column 
)
inline

Definition at line 572 of file PlayerDump.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetColumnIndexByName()

int32 GetColumnIndexByName ( TableStruct const &  tableStruct,
std::string const &  columnName 
)
inline

Definition at line 220 of file PlayerDump.cpp.

+ Here is the caller graph for this function:

◆ GetFileHandle()

FileHandle GetFileHandle ( char const *  path,
char const *  mode 
)
inline

Definition at line 60 of file PlayerDump.cpp.

+ Here is the caller graph for this function:

◆ GetTableName()

std::string GetTableName ( std::string const &  str)
inline

Definition at line 507 of file PlayerDump.cpp.

+ Here is the caller graph for this function:

◆ MarkDependentColumn()

void MarkDependentColumn ( TableStruct tableStruct,
std::string const &  columnName,
GuidType  dependentType 
)
inline

Definition at line 229 of file PlayerDump.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MarkWhereField()

void MarkWhereField ( TableStruct tableStruct,
std::string const &  whereField 
)
inline

Definition at line 252 of file PlayerDump.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RegisterNewGuid()

template<typename T , template< class, class, class... > class MapType, class... Rest>
T RegisterNewGuid ( oldGuid,
MapType< T, T, Rest... > &  guidMap,
guidOffset 
)
inline

Definition at line 582 of file PlayerDump.cpp.

+ Here is the caller graph for this function:

◆ StringsEqualCaseInsensitive()

bool StringsEqualCaseInsensitive ( std::string const &  left,
std::string const &  right 
)
inline

Definition at line 199 of file PlayerDump.cpp.

+ Here is the call graph for this function:

◆ ValidateFields()

bool ValidateFields ( TableStruct const &  ts,
std::string const &  str,
size_t  lineNumber 
)
inline

Definition at line 518 of file PlayerDump.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ BaseTables

BaseTable const BaseTables[]
Initial value:
=
{
{ "character_pet", "id", "owner", GUID_TYPE_PET },
{ "mail", "id", "receiver", GUID_TYPE_MAIL },
{ "item_instance", "guid", "owner_guid", GUID_TYPE_ITEM },
{ "character_equipmentsets", "setguid", "guid", GUID_TYPE_EQUIPMENT_SET },
{ "character_transmog_outfits", "setguid", "guid", GUID_TYPE_EQUIPMENT_SET }
}
@ GUID_TYPE_MAIL
Definition: PlayerDump.cpp:37
@ GUID_TYPE_PET
Definition: PlayerDump.cpp:43
@ GUID_TYPE_EQUIPMENT_SET
Definition: PlayerDump.cpp:41
@ GUID_TYPE_ITEM
Definition: PlayerDump.cpp:42

Definition at line 74 of file PlayerDump.cpp.

◆ CharacterTables

std::vector<TableStruct> CharacterTables

Definition at line 197 of file PlayerDump.cpp.

◆ DUMP_TABLE_COUNT

uint32 const DUMP_TABLE_COUNT = std::extent<decltype(DumpTables)>::value

Definition at line 153 of file PlayerDump.cpp.

◆ DumpTables

DumpTable const DumpTables[]

Definition at line 90 of file PlayerDump.cpp.