diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2016-10-03 17:45:01 -0700 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2016-10-03 17:45:01 -0700 |
| commit | 5d58eb29cc9ae584335e3380c2645baf05b21222 (patch) | |
| tree | 67800f8c43fdd437286c4d026cccf6a1a1c0527b /toolsrc/include | |
| parent | 2f8c115777cb5f1d407d8a9a05c2cd3c4cad918d (diff) | |
| download | vcpkg-5d58eb29cc9ae584335e3380c2645baf05b21222.tar.gz vcpkg-5d58eb29cc9ae584335e3380c2645baf05b21222.zip | |
[package_spec] Force using the factories that do sanity checks
Diffstat (limited to 'toolsrc/include')
| -rw-r--r-- | toolsrc/include/package_spec.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/toolsrc/include/package_spec.h b/toolsrc/include/package_spec.h index 942b34adc..7410145ca 100644 --- a/toolsrc/include/package_spec.h +++ b/toolsrc/include/package_spec.h @@ -8,12 +8,19 @@ namespace vcpkg { struct package_spec { - static expected<package_spec> from_string(const std::string& spec, const triplet& default_target_triplet); + static expected<package_spec> from_string(const std::string& spec_as_string, const triplet& default_target_triplet); - std::string name; - triplet target_triplet; + static package_spec 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; + + private: + std::string m_name; + triplet m_target_triplet; }; std::string to_string(const package_spec& spec); @@ -33,8 +40,8 @@ namespace std 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); + hash = hash * 31 + std::hash<std::string>()(value.name()); + hash = hash * 31 + std::hash<vcpkg::triplet>()(value.target_triplet()); return hash; } }; |
