1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 15:35:23 +00:00

added ID-argument to CollectionBase::getAppendIndex (required for info record collection)

This commit is contained in:
Marc Zinnschlag 2013-10-22 11:21:12 +02:00
parent aa61948801
commit dc473221e7
5 changed files with 10 additions and 7 deletions

View File

@ -104,7 +104,8 @@ namespace CSMWorld
virtual const Record<ESXRecordT>& getRecord (int index) const;
virtual int getAppendIndex (UniversalId::Type type = UniversalId::Type_None) const;
virtual int getAppendIndex (const std::string& id,
UniversalId::Type type = UniversalId::Type_None) const;
///< \param type Will be ignored, unless the collection supports multiple record types
virtual std::vector<std::string> getIds (bool listDeleted = true) const;
@ -293,7 +294,8 @@ namespace CSMWorld
}
template<typename ESXRecordT, typename IdAccessorT>
int Collection<ESXRecordT, IdAccessorT>::getAppendIndex (UniversalId::Type type) const
int Collection<ESXRecordT, IdAccessorT>::getAppendIndex (const std::string& id,
UniversalId::Type type) const
{
return static_cast<int> (mRecords.size());
}

View File

@ -76,7 +76,8 @@ namespace CSMWorld
virtual const RecordBase& getRecord (int index) const = 0;
virtual int getAppendIndex (UniversalId::Type type = UniversalId::Type_None) const = 0;
virtual int getAppendIndex (const std::string& id,
UniversalId::Type type = UniversalId::Type_None) const = 0;
///< \param type Will be ignored, unless the collection supports multiple record types
virtual std::vector<std::string> getIds (bool listDeleted = true) const = 0;

View File

@ -118,7 +118,7 @@ QModelIndex CSMWorld::IdTable::parent (const QModelIndex& index) const
void CSMWorld::IdTable::addRecord (const std::string& id, UniversalId::Type type)
{
int index = mIdCollection->getAppendIndex();
int index = mIdCollection->getAppendIndex (id, type);
beginInsertRows (QModelIndex(), index, index);
@ -138,7 +138,7 @@ void CSMWorld::IdTable::setRecord (const std::string& id, const RecordBase& reco
if (index==-1)
{
int index = mIdCollection->getAppendIndex();
int index = mIdCollection->getAppendIndex (id);
beginInsertRows (QModelIndex(), index, index);

View File

@ -530,7 +530,7 @@ void CSMWorld::RefIdCollection::load (ESM::ESMReader& reader, bool base, Univers
}
}
int CSMWorld::RefIdCollection::getAppendIndex (UniversalId::Type type) const
int CSMWorld::RefIdCollection::getAppendIndex (const std::string& id, UniversalId::Type type) const
{
return mData.getAppendIndex (type);
}

View File

@ -87,7 +87,7 @@ namespace CSMWorld
void load (ESM::ESMReader& reader, bool base, UniversalId::Type type);
virtual int getAppendIndex (UniversalId::Type type) const;
virtual int getAppendIndex (const std::string& id, UniversalId::Type type) const;
///< \param type Will be ignored, unless the collection supports multiple record types
virtual std::vector<std::string> getIds (bool listDeleted) const;