#pragma once #include "PackageSpecParseResult.h" #include "Triplet.h" #include "vcpkg_expected.h" namespace vcpkg { struct PackageSpec { static Expected from_string(const std::string& spec_as_string, const Triplet& default_triplet); static Expected from_name_and_triplet(const std::string& name, const Triplet& target_triplet); const std::string& name() const; const Triplet& target_triplet() const; std::string dir() const; std::string to_string() const; private: std::string m_name; Triplet m_target_triplet; }; bool operator==(const PackageSpec& left, const PackageSpec& right); } //namespace vcpkg namespace std { template <> struct hash { size_t operator()(const vcpkg::PackageSpec& value) const { size_t hash = 17; hash = hash * 31 + std::hash()(value.name()); hash = hash * 31 + std::hash()(value.target_triplet()); return hash; } }; template <> struct equal_to { bool operator()(const vcpkg::PackageSpec& left, const vcpkg::PackageSpec& right) const { return left == right; } }; } // namespace std