diff options
| author | jasjuang <jasjuang@gmail.com> | 2017-09-22 08:16:32 -0700 |
|---|---|---|
| committer | jasjuang <jasjuang@gmail.com> | 2017-09-22 08:16:32 -0700 |
| commit | f643a8422f87c5a16e3cc77e3e321e34a45f7103 (patch) | |
| tree | 419c9a2e74ab577aab0e868441b9a0e4c15d4919 /toolsrc/include/PackageSpec.h | |
| parent | 9989177fed607cdc9e20127ff7c22e3266e7c913 (diff) | |
| parent | fac96eb344a500405ab65b7e7f3755af0ad00b7e (diff) | |
| download | vcpkg-f643a8422f87c5a16e3cc77e3e321e34a45f7103.tar.gz vcpkg-f643a8422f87c5a16e3cc77e3e321e34a45f7103.zip | |
Merge branch 'master' of https://github.com/jasjuang/vcpkg
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); } |
