mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-04-19 03:20:11 +03:00
feat(db): add non-copy overload of WowClientDB::GetRecordByIndex
This commit is contained in:
parent
8745a5102d
commit
ef834d938e
@ -15,8 +15,22 @@ class WowClientDB : public WowClientDB_Common<T>, IDatabase<T> {
|
||||
virtual void LoadRecords(SFile* f, const char* filename, int32_t linenumber);
|
||||
virtual int32_t GetRecordByIndex(int32_t index, void* ptr) const;
|
||||
virtual T* GetRecord(int32_t id);
|
||||
|
||||
// Member functions
|
||||
T* GetRecordByIndex(int32_t index) const;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
T* WowClientDB<T>::GetRecordByIndex(int32_t index) const {
|
||||
STORM_ASSERT(this->m_numRecords >= 0);
|
||||
|
||||
if (index < 0 || index >= this->m_numRecords) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return &this->m_records[index];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
int32_t WowClientDB<T>::GetRecordByIndex(int32_t index, void* ptr) const {
|
||||
STORM_ASSERT(this->m_numRecords >= 0);
|
||||
|
Loading…
Reference in New Issue
Block a user