2013-06-17 09:42:02 +00:00
|
|
|
#include "collectionbase.hpp"
|
|
|
|
|
2013-09-27 13:04:09 +00:00
|
|
|
#include <stdexcept>
|
|
|
|
|
2022-10-19 17:02:00 +00:00
|
|
|
#include <apps/opencs/model/world/columns.hpp>
|
|
|
|
#include <apps/opencs/model/world/universalid.hpp>
|
|
|
|
|
2013-09-27 13:04:09 +00:00
|
|
|
#include "columnbase.hpp"
|
|
|
|
|
2013-06-17 09:42:02 +00:00
|
|
|
CSMWorld::CollectionBase::CollectionBase() {}
|
|
|
|
|
|
|
|
CSMWorld::CollectionBase::~CollectionBase() {}
|
2013-09-27 13:04:09 +00:00
|
|
|
|
2021-07-23 06:05:58 +00:00
|
|
|
int CSMWorld::CollectionBase::getInsertIndex(const std::string& id, UniversalId::Type type, RecordBase* record) const
|
|
|
|
{
|
|
|
|
return getAppendIndex(id, type);
|
|
|
|
}
|
|
|
|
|
2013-09-27 13:04:09 +00:00
|
|
|
int CSMWorld::CollectionBase::searchColumnIndex(Columns::ColumnId id) const
|
|
|
|
{
|
|
|
|
int columns = getColumns();
|
|
|
|
|
|
|
|
for (int i = 0; i < columns; ++i)
|
|
|
|
if (getColumn(i).mColumnId == id)
|
|
|
|
return i;
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int CSMWorld::CollectionBase::findColumnIndex(Columns::ColumnId id) const
|
|
|
|
{
|
|
|
|
int index = searchColumnIndex(id);
|
|
|
|
|
|
|
|
if (index == -1)
|
|
|
|
throw std::logic_error("invalid column index");
|
|
|
|
|
|
|
|
return index;
|
2015-03-11 14:54:45 +00:00
|
|
|
}
|