vcpkg/toolsrc/include/triplet.h

46 lines
1.0 KiB
C
Raw Normal View History

2016-09-19 11:50:08 +08:00
#pragma once
#include <string>
namespace vcpkg
{
2017-04-04 06:02:45 +08:00
struct Triplet
2016-09-19 11:50:08 +08:00
{
2017-04-04 06:02:45 +08:00
static Triplet from_canonical_name(const std::string& triplet_as_string);
2017-04-04 06:02:45 +08:00
static const Triplet X86_WINDOWS;
static const Triplet X64_WINDOWS;
static const Triplet X86_UWP;
static const Triplet X64_UWP;
static const Triplet ARM_UWP;
2016-09-19 11:50:08 +08:00
const std::string& canonical_name() const;
2016-09-19 11:50:08 +08:00
std::string architecture() const;
std::string system() const;
2017-04-08 08:44:24 +08:00
const std::string& to_string() const;
private:
std::string m_canonical_name;
2016-09-19 11:50:08 +08:00
};
2017-04-04 06:02:45 +08:00
bool operator==(const Triplet& left, const Triplet& right);
2016-09-19 11:50:08 +08:00
2017-04-04 06:02:45 +08:00
bool operator!=(const Triplet& left, const Triplet& right);
2016-09-19 11:50:08 +08:00
}
namespace std
{
template<>
2017-04-04 06:02:45 +08:00
struct hash<vcpkg::Triplet>
2016-09-19 11:50:08 +08:00
{
2017-04-04 06:02:45 +08:00
size_t operator()(const vcpkg::Triplet& t) const
2016-09-19 11:50:08 +08:00
{
std::hash<std::string> hasher;
size_t hash = 17;
hash = hash * 31 + hasher(t.canonical_name());
2016-09-19 11:50:08 +08:00
return hash;
}
};
} // namespace std