1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-04 02:41:19 +00:00
OpenMW/components/esm/formidrefid.hpp
2023-04-09 00:23:32 +02:00

50 lines
1.1 KiB
C++

#ifndef OPENMW_COMPONENTS_ESM_FORMIDREFID_HPP
#define OPENMW_COMPONENTS_ESM_FORMIDREFID_HPP
#include <functional>
#include <iosfwd>
#include <components/esm/formid.hpp>
namespace ESM
{
class FormIdRefId
{
public:
constexpr FormIdRefId() = default;
constexpr explicit FormIdRefId(ESM::FormId value) noexcept
: mValue(value)
{
}
ESM::FormId getValue() const { return mValue; }
std::string toString() const;
std::string toDebugString() const;
constexpr bool operator==(FormIdRefId rhs) const noexcept { return mValue == rhs.mValue; }
constexpr bool operator<(FormIdRefId rhs) const noexcept { return mValue < rhs.mValue; }
friend std::ostream& operator<<(std::ostream& stream, FormIdRefId value);
friend struct std::hash<FormIdRefId>;
private:
ESM::FormId mValue;
};
}
namespace std
{
template <>
struct hash<ESM::FormIdRefId>
{
std::size_t operator()(ESM::FormIdRefId value) const noexcept { return std::hash<ESM::FormId>{}(value.mValue); }
};
}
#endif