#pragma once #include "package_spec_parse_result.h" #include "triplet.h" #include "vcpkg_expected.h" namespace vcpkg { struct package_spec { static expected from_string(const std::string& spec_as_string, const triplet& default_target_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 display_name() const; std::string dir() const; std::string toString() const; private: std::string m_name; triplet m_target_triplet; }; std::string to_printf_arg(const package_spec& spec); bool operator==(const package_spec& left, const package_spec& right); std::ostream& operator<<(std::ostream& os, const package_spec& spec); } //namespace vcpkg namespace std { template <> struct hash { size_t operator()(const vcpkg::package_spec& 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::package_spec& left, const vcpkg::package_spec& right) const { return left == right; } }; } // namespace std