diff options
| author | Alexander Karatarakis <alex@karatarakis.com> | 2017-09-21 12:22:00 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-09-21 12:22:00 -0700 |
| commit | fac96eb344a500405ab65b7e7f3755af0ad00b7e (patch) | |
| tree | f9e3376ca1a8f2de408e087e42ae393f224d6c42 /toolsrc/include/PackageSpec.h | |
| parent | 46db0f03fcb42d9f738474885fda372160362e44 (diff) | |
| parent | 1bbce1ee844262647f994afd5f31da12d938e7ee (diff) | |
| download | vcpkg-fac96eb344a500405ab65b7e7f3755af0ad00b7e.tar.gz vcpkg-fac96eb344a500405ab65b7e7f3755af0ad00b7e.zip | |
Merge branch 'master' into master
Diffstat (limited to 'toolsrc/include/PackageSpec.h')
| -rw-r--r-- | toolsrc/include/PackageSpec.h | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/toolsrc/include/PackageSpec.h b/toolsrc/include/PackageSpec.h index 15b5e5b9b..c5ce767f9 100644 --- a/toolsrc/include/PackageSpec.h +++ b/toolsrc/include/PackageSpec.h @@ -1,14 +1,22 @@ #pragma once + #include "PackageSpecParseResult.h" -#include "SourceParagraph.h" #include "Triplet.h" #include "vcpkg_expected.h" namespace vcpkg { + struct ParsedSpecifier + { + std::string name; + std::vector<std::string> features; + std::string triplet; + + static ExpectedT<ParsedSpecifier, PackageSpecParseResult> from_string(const std::string& input); + }; + struct PackageSpec { - static std::string to_string(const std::string& name, const Triplet& triplet); static ExpectedT<PackageSpec, PackageSpecParseResult> from_name_and_triplet(const std::string& name, const Triplet& triplet); @@ -25,15 +33,45 @@ namespace vcpkg Triplet m_triplet; }; + struct FeatureSpec + { + FeatureSpec(const PackageSpec& spec, const std::string& feature) : m_spec(spec), m_feature(feature) {} + + const std::string& name() const { return m_spec.name(); } + const std::string& feature() const { return m_feature; } + const Triplet& triplet() const { return m_spec.triplet(); } + + const PackageSpec& spec() const { return m_spec; } + + std::string to_string() const; + + static std::vector<FeatureSpec> from_strings_and_triplet(const std::vector<std::string>& depends, + const Triplet& t); + + private: + PackageSpec m_spec; + std::string m_feature; + }; + struct FullPackageSpec { PackageSpec package_spec; std::vector<std::string> features; + static std::vector<FeatureSpec> to_feature_specs(const std::vector<FullPackageSpec>& specs); + static ExpectedT<FullPackageSpec, PackageSpecParseResult> from_string(const std::string& spec_as_string, const Triplet& default_triplet); }; + struct Features + { + std::string name; + std::vector<std::string> features; + + static ExpectedT<Features, PackageSpecParseResult> from_string(const std::string& input); + }; + bool operator==(const PackageSpec& left, const PackageSpec& right); bool operator!=(const PackageSpec& left, const PackageSpec& right); } |
