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);
|
2016-10-04 08:20:52 +08:00
|
|
|
|
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
|
|
|
|
2016-10-04 08:20:52 +08:00
|
|
|
const std::string& canonical_name() const;
|
2016-09-19 11:50:08 +08:00
|
|
|
|
|
|
|
std::string architecture() const;
|
|
|
|
|
|
|
|
std::string system() const;
|
2016-10-04 08:20:52 +08:00
|
|
|
|
|
|
|
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
|
|
|
|
2017-04-04 06:02:45 +08:00
|
|
|
std::string to_string(const Triplet& spec);
|
2016-09-19 11:50:08 +08:00
|
|
|
|
2017-04-04 06:02:45 +08:00
|
|
|
std::string to_printf_arg(const Triplet& spec);
|
2016-09-19 11:50:08 +08:00
|
|
|
|
2017-04-04 06:02:45 +08:00
|
|
|
std::ostream& operator<<(std::ostream& os, const Triplet& spec);
|
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;
|
2016-10-04 08:20:52 +08:00
|
|
|
hash = hash * 31 + hasher(t.canonical_name());
|
2016-09-19 11:50:08 +08:00
|
|
|
return hash;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace std
|