mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-25 18:41:33 +00:00
some clean and better comments
This commit is contained in:
parent
69d70d64f6
commit
d6d2a37d03
2 changed files with 11 additions and 35 deletions
|
@ -27,16 +27,3 @@ ESM::RefId ESM::RefId::stringRefId(const std::string_view & id)
|
||||||
|
|
||||||
const ESM::RefId ESM::RefId::sEmpty = ESM::RefId::stringRefId("");
|
const ESM::RefId ESM::RefId::sEmpty = ESM::RefId::stringRefId("");
|
||||||
|
|
||||||
//template<>
|
|
||||||
//std::size_t std::hash<ESM::RefId>::operator()(const ESM::RefId& k) const
|
|
||||||
//{
|
|
||||||
// using std::size_t;
|
|
||||||
// using std::hash;
|
|
||||||
// using std::string;
|
|
||||||
//
|
|
||||||
// // Compute individual hash values for first,
|
|
||||||
// // second and third and combine them using XOR
|
|
||||||
// // and bit shifting:
|
|
||||||
//
|
|
||||||
// return hash<string>()(k.getRefIdString());
|
|
||||||
//}
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#ifndef OPENMW_COMPONENTS_ESM_REFID_HPP
|
#ifndef OPENMW_COMPONENTS_ESM_REFID_HPP
|
||||||
#define OPENMW_COMPONENTS_ESM_REFID_HPP
|
#define OPENMW_COMPONENTS_ESM_REFID_HPP
|
||||||
#include <string>
|
|
||||||
#include <iosfwd>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <iosfwd>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
{
|
{
|
||||||
|
@ -14,45 +14,34 @@ namespace ESM
|
||||||
void swap(RefId& rhs) { mId.swap(rhs.mId); }
|
void swap(RefId& rhs) { mId.swap(rhs.mId); }
|
||||||
bool operator==(const RefId& rhs) const { return mId == rhs.mId; }
|
bool operator==(const RefId& rhs) const { return mId == rhs.mId; }
|
||||||
void operator=(const RefId& rhs) { mId = rhs.mId; }
|
void operator=(const RefId& rhs) { mId = rhs.mId; }
|
||||||
bool operator <(const RefId& rhs) const
|
bool operator<(const RefId& rhs) const { return mId < rhs.mId; }
|
||||||
{
|
bool operator>(const RefId& rhs) const { return mId > rhs.mId; }
|
||||||
return mId < rhs.mId;
|
static bool ciEqual(const RefId& left, const RefId& right);
|
||||||
}
|
|
||||||
bool operator >(const RefId& rhs) const
|
|
||||||
{
|
|
||||||
return mId > rhs.mId;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend std::ostream& operator<<(std::ostream& os, const RefId& dt);
|
friend std::ostream& operator<<(std::ostream& os, const RefId& dt);
|
||||||
|
|
||||||
static RefId stringRefId(
|
static RefId stringRefId(const std::string_view& id); //The
|
||||||
const std::string_view& id); // This makes it very visible the places where I had to convert from string to Refid
|
std::string& getRefIdString() { return mId; }
|
||||||
|
const std::string& getRefIdString() const { return mId; }
|
||||||
|
|
||||||
std::string& getRefIdString() { return mId; } // Same thing
|
|
||||||
const std::string& getRefIdString() const { return mId; } // Same thing
|
|
||||||
|
|
||||||
static bool ciEqual(const RefId& left, const RefId& right);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string mId;
|
std::string mId;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace std {
|
namespace std
|
||||||
|
{
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct hash<ESM::RefId>
|
struct hash<ESM::RefId>
|
||||||
{
|
{
|
||||||
std::size_t operator()(const ESM::RefId& k) const
|
std::size_t operator()(const ESM::RefId& k) const
|
||||||
{
|
{
|
||||||
using std::size_t;
|
|
||||||
using std::hash;
|
using std::hash;
|
||||||
|
using std::size_t;
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
// Compute individual hash values for first,
|
|
||||||
// second and third and combine them using XOR
|
|
||||||
// and bit shifting:
|
|
||||||
|
|
||||||
return hash<string>()(k.getRefIdString());
|
return hash<string>()(k.getRefIdString());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue