diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2016-09-18 20:50:08 -0700 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2016-09-18 20:54:03 -0700 |
| commit | ccca198c1b1730b0241911cb56dc8e3504958b2a (patch) | |
| tree | a2dd9b8b087a09afdcecc5cbb3377bed15127eb2 /toolsrc/include/package_spec.h | |
| download | vcpkg-ccca198c1b1730b0241911cb56dc8e3504958b2a.tar.gz vcpkg-ccca198c1b1730b0241911cb56dc8e3504958b2a.zip | |
Initial commit
Diffstat (limited to 'toolsrc/include/package_spec.h')
| -rw-r--r-- | toolsrc/include/package_spec.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/toolsrc/include/package_spec.h b/toolsrc/include/package_spec.h new file mode 100644 index 000000000..b8ed1e088 --- /dev/null +++ b/toolsrc/include/package_spec.h @@ -0,0 +1,50 @@ +#pragma once +#include <string> +#include "package_spec_parse_result.h" +#include "triplet.h" +#include "expected.h" + +namespace vcpkg +{ + struct package_spec + { + std::string name; + triplet target_triplet; + + std::string dir() const; + }; + + expected<package_spec> parse(const std::string& spec, const triplet& default_target_triplet); + + std::string to_string(const package_spec& spec); + + 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<vcpkg::package_spec> + { + size_t operator()(const vcpkg::package_spec& value) const + { + size_t hash = 17; + hash = hash * 31 + std::hash<std::string>()(value.name); + hash = hash * 31 + std::hash<vcpkg::triplet>()(value.target_triplet); + return hash; + } + }; + + template <> + struct equal_to<vcpkg::package_spec> + { + bool operator()(const vcpkg::package_spec& left, const vcpkg::package_spec& right) const + { + return left == right; + } + }; +} // namespace std |
