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
78: file(file), offset(offset) {}
DBCFile & file
Definition: dbcfile.h:79
unsigned char * offset
Definition: dbcfile.h:80

◆ Record() [2/2]

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

Member Function Documentation

◆ getByte()

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

References file, offset, and DBCFile::recordSize.

◆ getFloat() [1/2]

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

References DBCFile::fieldCount, file, and offset.

◆ getFloat() [2/2]

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

References DBCFile::fieldCount, file, and offset.

◆ getInt() [1/2]

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

References DBCFile::fieldCount, file, and offset.

◆ getInt() [2/2]

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

References DBCFile::fieldCount, file, and offset.

◆ getString() [1/2]

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

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
87 {
88 assert(field < file.fieldCount);
89 std::size_t stringOffset = getUInt(field);
90 assert(stringOffset < file.stringSize);
91 //char * tmp = (char*)file.stringTable + stringOffset;
92 //unsigned char * tmp2 = file.stringTable + stringOffset;
93 return reinterpret_cast<char*>(file.stringTable + stringOffset);
94 }

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

◆ getUInt() [1/2]

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

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
72 {
73 assert(field < file.fieldCount);
74 return *reinterpret_cast<unsigned int*>(offset + (field * 4));
75 }

References DBCFile::fieldCount, file, and offset.

◆ operator=()

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

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