AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
DBCFile::Record Class Reference

#include "dbcfile.h"

Public Member Functions

float getFloat (std::size_t field) const
 
unsigned int getUInt (std::size_t field) const
 
int getInt (std::size_t field) const
 
const char * getString (std::size_t field) const
 
Recordoperator= (const Record &r)
 
float getFloat (std::size_t field) const
 
unsigned int getUInt (std::size_t field) const
 
int getInt (std::size_t field) const
 
unsigned char getByte (std::size_t ofs) const
 
const char * getString (std::size_t field) const
 

Private Member Functions

 Record (DBCFile &file, unsigned char *offset)
 
 Record (DBCFile &file, unsigned char *offset)
 

Private Attributes

DBCFilefile
 
unsigned char * offset
 

Friends

class DBCFile
 
class DBCFile::Iterator
 
class Iterator
 

Detailed Description

Constructor & Destructor Documentation

◆ Record() [1/2]

DBCFile::Record::Record ( DBCFile file,
unsigned char *  offset 
)
inlineprivate
79: file(file), offset(offset) {}
DBCFile & file
Definition: dbcfile.h:80
unsigned char * offset
Definition: dbcfile.h:81

◆ Record() [2/2]

DBCFile::Record::Record ( DBCFile file,
unsigned char *  offset 
)
inlineprivate
97: file(file), offset(offset) {}

Member Function Documentation

◆ getByte()

unsigned char DBCFile::Record::getByte ( std::size_t  ofs) const
inline
83 {
84 assert(ofs < file.recordSize);
85 return *reinterpret_cast<unsigned char*>(offset + ofs);
86 }
std::size_t recordSize
Definition: dbcfile.h:130

References file, offset, and DBCFile::recordSize.

◆ getFloat() [1/2]

float DBCFile::Record::getFloat ( std::size_t  field) const
inline
57 {
58 assert(field < file.fieldCount);
59 return *reinterpret_cast<float*>(offset + field * 4);
60 }
std::size_t fieldCount
Definition: dbcfile.h:132

References DBCFile::fieldCount, file, and offset.

◆ getFloat() [2/2]

float DBCFile::Record::getFloat ( std::size_t  field) const
inline
68 {
69 assert(field < file.fieldCount);
70 return *reinterpret_cast<float*>(offset + field * 4);
71 }

References DBCFile::fieldCount, file, and offset.

◆ getInt() [1/2]

int DBCFile::Record::getInt ( std::size_t  field) const
inline
67 {
68 assert(field < file.fieldCount);
69 return *reinterpret_cast<int*>(offset + field * 4);
70 }

References DBCFile::fieldCount, file, and offset.

◆ getInt() [2/2]

int DBCFile::Record::getInt ( std::size_t  field) const
inline
78 {
79 assert(field < file.fieldCount);
80 return *reinterpret_cast<int*>(offset + field * 4);
81 }

References DBCFile::fieldCount, file, and offset.

◆ getString() [1/2]

const char * DBCFile::Record::getString ( std::size_t  field) const
inline
72 {
73 assert(field < file.fieldCount);
74 std::size_t stringOffset = getUInt(field);
75 assert(stringOffset < file.stringSize);
76 return reinterpret_cast<char*>(file.stringTable + stringOffset);
77 }
std::size_t stringSize
Definition: dbcfile.h:133
unsigned char * stringTable
Definition: dbcfile.h:135
unsigned int getUInt(std::size_t field) const
Definition: dbcfile.h:61

References DBCFile::fieldCount, file, getUInt(), DBCFile::stringSize, and DBCFile::stringTable.

Referenced by ExtractCameraFiles(), main(), and ReadMapDBC().

◆ getString() [2/2]

const char * DBCFile::Record::getString ( std::size_t  field) const
inline
88 {
89 assert(field < file.fieldCount);
90 std::size_t stringOffset = getUInt(field);
91 assert(stringOffset < file.stringSize);
92 //char * tmp = (char*)file.stringTable + stringOffset;
93 //unsigned char * tmp2 = file.stringTable + stringOffset;
94 return reinterpret_cast<char*>(file.stringTable + stringOffset);
95 }

References DBCFile::fieldCount, file, getUInt(), DBCFile::stringSize, and DBCFile::stringTable.

◆ getUInt() [1/2]

unsigned int DBCFile::Record::getUInt ( std::size_t  field) const
inline
62 {
63 assert(field < file.fieldCount);
64 return *reinterpret_cast<unsigned int*>(offset + field * 4);
65 }

References DBCFile::fieldCount, file, and offset.

Referenced by DBCFile::getMaxId(), getString(), main(), ReadLiquidTypeTableDBC(), and ReadMapDBC().

◆ getUInt() [2/2]

unsigned int DBCFile::Record::getUInt ( std::size_t  field) const
inline
73 {
74 assert(field < file.fieldCount);
75 return *reinterpret_cast<unsigned int*>(offset + (field * 4));
76 }

References DBCFile::fieldCount, file, and offset.

◆ operator=()

Record & DBCFile::Record::operator= ( const Record r)
inline
62 {
63 file = r.file;
64 offset = r.offset;
65 return *this;
66 }

References file, and offset.

Friends And Related Function Documentation

◆ DBCFile

DBCFile
friend

◆ DBCFile::Iterator

friend class DBCFile::Iterator
friend

◆ Iterator

friend class Iterator
friend

Member Data Documentation

◆ file

DBCFile & DBCFile::Record::file
private

◆ offset