Remove redundant ESM::RefId member functions

iwyu_full
elsid 2 years ago
parent fe57aec2a4
commit 755067f0f3
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

@ -22,6 +22,7 @@
#include "esmstore.hpp"
#include "player.hpp"
#include <algorithm>
#include <cmath>
namespace MWWorld
@ -932,7 +933,7 @@ namespace MWWorld
ESM::WeatherState state;
state.load(reader);
mCurrentRegion.swap(state.mCurrentRegion);
std::swap(mCurrentRegion, state.mCurrentRegion);
mTimePassed = state.mTimePassed;
mFastForward = state.mFastForward;
mWeatherUpdateTime = state.mWeatherUpdateTime;

@ -16,11 +16,6 @@ namespace ESM
return Misc::StringUtils::ciLess(mId, rhs.mId);
}
bool RefId::operator>(const RefId& rhs) const
{
return Misc::StringUtils::ciGreater(mId, rhs.mId);
}
std::ostream& operator<<(std::ostream& os, const RefId& refId)
{
os << refId.getRefIdString();

@ -1,6 +1,6 @@
#ifndef OPENMW_COMPONENTS_ESM_REFID_HPP
#define OPENMW_COMPONENTS_ESM_REFID_HPP
#include <compare>
#include <functional>
#include <iosfwd>
#include <string>
@ -14,11 +14,12 @@ namespace ESM
struct RefId
{
const static RefId sEmpty;
bool empty() const { return mId.empty(); }
void swap(RefId& rhs) { mId.swap(rhs.mId); }
bool operator==(const RefId& rhs) const;
bool operator<(const RefId& rhs) const;
bool operator>(const RefId& rhs) const;
friend std::ostream& operator<<(std::ostream& os, const RefId& dt);

@ -2,8 +2,10 @@
#define COMPONENTS_ESM_MAGICEFFECTS_H
#include <components/esm/refid.hpp>
#include <map>
#include <string>
#include <tuple>
namespace ESM
{
@ -29,30 +31,25 @@ namespace ESM
{
}
bool operator==(const SummonKey& other) const
{
return mEffectId == other.mEffectId && mSourceId == other.mSourceId && mEffectIndex == other.mEffectIndex;
}
bool operator<(const SummonKey& other) const
{
if (mEffectId < other.mEffectId)
return true;
if (mEffectId > other.mEffectId)
return false;
if (mSourceId < other.mSourceId)
return true;
if (mSourceId > other.mSourceId)
return false;
return mEffectIndex < other.mEffectIndex;
}
int mEffectId;
ESM::RefId mSourceId;
int mEffectIndex;
};
inline auto makeTupleRef(const SummonKey& value) noexcept
{
return std::tie(value.mEffectId, value.mSourceId, value.mEffectIndex);
}
inline bool operator==(const SummonKey& l, const SummonKey& r) noexcept
{
return makeTupleRef(l) == makeTupleRef(r);
}
inline bool operator<(const SummonKey& l, const SummonKey& r) noexcept
{
return makeTupleRef(l) < makeTupleRef(r);
}
}
#endif

@ -20,16 +20,6 @@ namespace Misc::StringUtils
return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end(), CiCharLess());
}
struct CiCharGreater
{
bool operator()(char x, char y) const { return toLower(x) > toLower(y); }
};
inline bool ciGreater(std::string_view x, std::string_view y)
{
return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end(), CiCharGreater());
}
inline bool ciEqual(std::string_view x, std::string_view y)
{
if (std::size(x) != std::size(y))

Loading…
Cancel
Save