|
|
|
@ -38,27 +38,19 @@ namespace ESM
|
|
|
|
|
|
|
|
|
|
Item& item = it->second;
|
|
|
|
|
|
|
|
|
|
const auto insertOrSplice = [&](typename std::list<T>::const_iterator before) {
|
|
|
|
|
if (item.mPosition == mOrderedInfo.end())
|
|
|
|
|
item.mPosition = mOrderedInfo.insert(before, std::forward<V>(value));
|
|
|
|
|
else
|
|
|
|
|
mOrderedInfo.splice(before, mOrderedInfo, item.mPosition);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (value.mPrev.empty())
|
|
|
|
|
{
|
|
|
|
|
insertOrSplice(mOrderedInfo.begin());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const auto prevIt = mInfoPositions.find(value.mPrev);
|
|
|
|
|
if (prevIt != mInfoPositions.end())
|
|
|
|
|
auto before = mOrderedInfo.begin();
|
|
|
|
|
if (!value.mPrev.empty())
|
|
|
|
|
{
|
|
|
|
|
insertOrSplice(std::next(prevIt->second.mPosition));
|
|
|
|
|
return;
|
|
|
|
|
const auto prevIt = mInfoPositions.find(value.mPrev);
|
|
|
|
|
if (prevIt != mInfoPositions.end())
|
|
|
|
|
before = std::next(prevIt->second.mPosition);
|
|
|
|
|
else
|
|
|
|
|
before = mOrderedInfo.end();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
insertOrSplice(mOrderedInfo.end());
|
|
|
|
|
if (item.mPosition == mOrderedInfo.end())
|
|
|
|
|
item.mPosition = mOrderedInfo.insert(before, std::forward<V>(value));
|
|
|
|
|
else
|
|
|
|
|
mOrderedInfo.splice(before, mOrderedInfo, item.mPosition);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void removeInfo(const RefId& infoRefId)
|
|
|
|
|