18#ifndef DBC_FILE_LOADER_H
19#define DBC_FILE_LOADER_H
46 bool Load(
const char *filename,
const char *
fmt);
53 ASSERT(field < file.fieldCount);
54 float val = *
reinterpret_cast<float*
>(offset + file.GetOffset(field));
60 ASSERT(field < file.fieldCount);
61 uint32 val = *
reinterpret_cast<uint32*
>(offset + file.GetOffset(field));
67 ASSERT(field < file.fieldCount);
68 return *
reinterpret_cast<uint8*
>(offset + file.GetOffset(field));
73 ASSERT(field < file.fieldCount);
74 size_t stringOffset = getUInt(field);
75 ASSERT(stringOffset < file.stringSize);
76 return reinterpret_cast<char*
>(file.stringTable + stringOffset);
89 Record getRecord(
size_t id);
95 uint32 GetOffset(
size_t id)
const {
return (fieldsOffset !=
nullptr &&
id < fieldCount) ? fieldsOffset[id] : 0; }
96 bool IsLoaded()
const {
return data !=
nullptr; }
97 char* AutoProduceData(
char const*
fmt,
uint32& count,
char**& indexTable);
98 char* AutoProduceStrings(
char const*
fmt,
char* dataTable);
99 static uint32 GetFormatRecordSize(
const char * format,
int32 * index_pos =
nullptr);
void EndianConvert(T &val)
Record(DBCFileLoader &file_, unsigned char *offset_)
const char * getString(size_t field) const
uint32 getUInt(size_t field) const
float getFloat(size_t field) const
uint8 getUInt8(size_t field) const
DBCFileLoader(DBCFileLoader const &right)=delete
unsigned char * stringTable
uint32 GetOffset(size_t id) const
DBCFileLoader & operator=(DBCFileLoader const &right)=delete
uint32 GetNumRows() const
Get begin iterator over records.
uint32 GetRowSize() const