mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/DataStores: Made DB2LoadInfo constexpr
This commit is contained in:
@@ -109,19 +109,11 @@ struct DB2IndexData
|
||||
std::vector<DB2IndexEntry> Entries;
|
||||
};
|
||||
|
||||
DB2FileLoadInfo::DB2FileLoadInfo(DB2FieldMeta const* fields, std::size_t fieldCount, DB2Meta const* meta)
|
||||
: Fields(fields), FieldCount(fieldCount), Meta(meta)
|
||||
{
|
||||
TypesString.reserve(FieldCount);
|
||||
for (std::size_t i = 0; i < FieldCount; ++i)
|
||||
TypesString += char(Fields[i].Type);
|
||||
}
|
||||
|
||||
uint32 DB2FileLoadInfo::GetStringFieldCount(bool localizedOnly) const
|
||||
{
|
||||
uint32 stringFields = 0;
|
||||
for (char fieldType : TypesString)
|
||||
if (fieldType == FT_STRING || (fieldType == FT_STRING_NOT_LOCALIZED && !localizedOnly))
|
||||
for (std::size_t i = 0; i < FieldCount; ++i)
|
||||
if (Fields[i].Type == FT_STRING || (Fields[i].Type == FT_STRING_NOT_LOCALIZED && !localizedOnly))
|
||||
++stringFields;
|
||||
|
||||
return stringFields;
|
||||
@@ -428,7 +420,7 @@ char* DB2FileLoaderRegularImpl::AutoProduceData(uint32& indexTableSize, char**&
|
||||
{
|
||||
for (uint32 z = 0; z < _loadInfo->Meta->Fields[x].ArraySize; ++z)
|
||||
{
|
||||
switch (_loadInfo->TypesString[fieldIndex])
|
||||
switch (_loadInfo->Fields[fieldIndex].Type)
|
||||
{
|
||||
case FT_FLOAT:
|
||||
*((float*)(&dataTable[offset])) = RecordGetFloat(rawRecord, x, z);
|
||||
@@ -462,7 +454,7 @@ char* DB2FileLoaderRegularImpl::AutoProduceData(uint32& indexTableSize, char**&
|
||||
break;
|
||||
default:
|
||||
ABORT_MSG("Unknown format character '%c' found in %s meta for field %s",
|
||||
_loadInfo->TypesString[fieldIndex], _fileName, _loadInfo->Fields[fieldIndex].Name);
|
||||
_loadInfo->Fields[fieldIndex].Type, _fileName, _loadInfo->Fields[fieldIndex].Name);
|
||||
break;
|
||||
}
|
||||
++fieldIndex;
|
||||
@@ -473,7 +465,7 @@ char* DB2FileLoaderRegularImpl::AutoProduceData(uint32& indexTableSize, char**&
|
||||
{
|
||||
for (uint32 z = 0; z < _loadInfo->Meta->Fields[x].ArraySize; ++z)
|
||||
{
|
||||
switch (_loadInfo->TypesString[fieldIndex])
|
||||
switch (_loadInfo->Fields[fieldIndex].Type)
|
||||
{
|
||||
case FT_INT:
|
||||
*((uint32*)(&dataTable[offset])) = 0;
|
||||
@@ -489,7 +481,7 @@ char* DB2FileLoaderRegularImpl::AutoProduceData(uint32& indexTableSize, char**&
|
||||
break;
|
||||
default:
|
||||
ABORT_MSG("Unknown format character '%c' found in %s meta for parent field %s",
|
||||
_loadInfo->TypesString[fieldIndex], _fileName, _loadInfo->Fields[fieldIndex].Name);
|
||||
_loadInfo->Fields[fieldIndex].Type, _fileName, _loadInfo->Fields[fieldIndex].Name);
|
||||
break;
|
||||
}
|
||||
++fieldIndex;
|
||||
@@ -566,7 +558,7 @@ char* DB2FileLoaderRegularImpl::AutoProduceStrings(char** indexTable, uint32 ind
|
||||
{
|
||||
for (uint32 z = 0; z < _loadInfo->Meta->Fields[x].ArraySize; ++z)
|
||||
{
|
||||
switch (_loadInfo->TypesString[fieldIndex])
|
||||
switch (_loadInfo->Fields[fieldIndex].Type)
|
||||
{
|
||||
case FT_FLOAT:
|
||||
case FT_INT:
|
||||
@@ -595,7 +587,7 @@ char* DB2FileLoaderRegularImpl::AutoProduceStrings(char** indexTable, uint32 ind
|
||||
}
|
||||
default:
|
||||
ABORT_MSG("Unknown format character '%c' found in %s meta for field %s",
|
||||
_loadInfo->TypesString[fieldIndex], _fileName, _loadInfo->Fields[fieldIndex].Name);
|
||||
_loadInfo->Fields[fieldIndex].Type, _fileName, _loadInfo->Fields[fieldIndex].Name);
|
||||
break;
|
||||
}
|
||||
++fieldIndex;
|
||||
@@ -1113,7 +1105,7 @@ char* DB2FileLoaderSparseImpl::AutoProduceData(uint32& indexTableSize, char**& i
|
||||
{
|
||||
for (uint32 z = 0; z < _loadInfo->Meta->Fields[x].ArraySize; ++z)
|
||||
{
|
||||
switch (_loadInfo->TypesString[fieldIndex])
|
||||
switch (_loadInfo->Fields[fieldIndex].Type)
|
||||
{
|
||||
case FT_FLOAT:
|
||||
*((float*)(&dataTable[offset])) = RecordGetFloat(rawRecord, x, z);
|
||||
@@ -1147,7 +1139,7 @@ char* DB2FileLoaderSparseImpl::AutoProduceData(uint32& indexTableSize, char**& i
|
||||
break;
|
||||
default:
|
||||
ABORT_MSG("Unknown format character '%c' found in %s meta for field %s",
|
||||
_loadInfo->TypesString[fieldIndex], _fileName, _loadInfo->Fields[fieldIndex].Name);
|
||||
_loadInfo->Fields[fieldIndex].Type, _fileName, _loadInfo->Fields[fieldIndex].Name);
|
||||
break;
|
||||
}
|
||||
++fieldIndex;
|
||||
@@ -1158,7 +1150,7 @@ char* DB2FileLoaderSparseImpl::AutoProduceData(uint32& indexTableSize, char**& i
|
||||
{
|
||||
for (uint32 z = 0; z < _loadInfo->Meta->Fields[x].ArraySize; ++z)
|
||||
{
|
||||
switch (_loadInfo->TypesString[fieldIndex])
|
||||
switch (_loadInfo->Fields[fieldIndex].Type)
|
||||
{
|
||||
case FT_INT:
|
||||
*((uint32*)(&dataTable[offset])) = 0;
|
||||
@@ -1174,7 +1166,7 @@ char* DB2FileLoaderSparseImpl::AutoProduceData(uint32& indexTableSize, char**& i
|
||||
break;
|
||||
default:
|
||||
ABORT_MSG("Unknown format character '%c' found in %s meta for parent field %s",
|
||||
_loadInfo->TypesString[fieldIndex], _fileName, _loadInfo->Fields[fieldIndex].Name);
|
||||
_loadInfo->Fields[fieldIndex].Type, _fileName, _loadInfo->Fields[fieldIndex].Name);
|
||||
break;
|
||||
}
|
||||
++fieldIndex;
|
||||
@@ -1263,7 +1255,7 @@ char* DB2FileLoaderSparseImpl::AutoProduceStrings(char** indexTable, uint32 inde
|
||||
{
|
||||
for (uint32 z = 0; z < _loadInfo->Meta->Fields[x].ArraySize; ++z)
|
||||
{
|
||||
switch (_loadInfo->TypesString[fieldIndex])
|
||||
switch (_loadInfo->Fields[fieldIndex].Type)
|
||||
{
|
||||
case FT_FLOAT:
|
||||
offset += 4;
|
||||
@@ -1300,7 +1292,7 @@ char* DB2FileLoaderSparseImpl::AutoProduceStrings(char** indexTable, uint32 inde
|
||||
}
|
||||
default:
|
||||
ABORT_MSG("Unknown format character '%c' found in %s meta for field %s",
|
||||
_loadInfo->TypesString[fieldIndex], _fileName, _loadInfo->Fields[fieldIndex].Name);
|
||||
_loadInfo->Fields[fieldIndex].Type, _fileName, _loadInfo->Fields[fieldIndex].Name);
|
||||
break;
|
||||
}
|
||||
++fieldIndex;
|
||||
|
||||
Reference in New Issue
Block a user