diff options
Diffstat (limited to 'toolsrc/include')
| -rw-r--r-- | toolsrc/include/vcpkg-test/util.h | 6 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/optional.h | 26 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/dependencies.h | 2 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/remove.h | 1 |
4 files changed, 27 insertions, 8 deletions
diff --git a/toolsrc/include/vcpkg-test/util.h b/toolsrc/include/vcpkg-test/util.h index d2c512f9b..1e20531fc 100644 --- a/toolsrc/include/vcpkg-test/util.h +++ b/toolsrc/include/vcpkg-test/util.h @@ -32,6 +32,12 @@ namespace Catch value.package_spec.triplet()); } }; + + template<> + struct StringMaker<vcpkg::Triplet> + { + static const std::string& convert(const vcpkg::Triplet& triplet) { return triplet.canonical_name(); } + }; } namespace vcpkg::Test diff --git a/toolsrc/include/vcpkg/base/optional.h b/toolsrc/include/vcpkg/base/optional.h index c66f891c7..d8c72ca6d 100644 --- a/toolsrc/include/vcpkg/base/optional.h +++ b/toolsrc/include/vcpkg/base/optional.h @@ -288,32 +288,46 @@ namespace vcpkg using map_t = decltype(std::declval<F&>()(std::declval<const T&>())); template<class F, class U = map_t<F>> - U then(F f) const& + Optional<U> map(F f) const& { if (has_value()) { return f(this->m_base.value()); } - else + return nullopt; + } + + template<class F, class U = map_t<F>> + U then(F f) const& + { + if (has_value()) { - return nullopt; + return f(this->m_base.value()); } + return nullopt; } template<class F> using move_map_t = decltype(std::declval<F&>()(std::declval<T&&>())); template<class F, class U = move_map_t<F>> - U then(F f) && + Optional<U> map(F f) && { if (has_value()) { return f(std::move(this->m_base.value())); } - else + return nullopt; + } + + template<class F, class U = move_map_t<F>> + U then(F f) && + { + if (has_value()) { - return nullopt; + return f(std::move(this->m_base.value())); } + return nullopt; } friend bool operator==(const Optional& lhs, const Optional& rhs) diff --git a/toolsrc/include/vcpkg/dependencies.h b/toolsrc/include/vcpkg/dependencies.h index 4736bc02c..1b1a7748b 100644 --- a/toolsrc/include/vcpkg/dependencies.h +++ b/toolsrc/include/vcpkg/dependencies.h @@ -132,7 +132,7 @@ namespace vcpkg::Dependencies RequestType request_type; Optional<const BinaryParagraph&> core_paragraph() const; - std::vector<PackageSpec> dependencies(Triplet triplet) const; + std::vector<PackageSpec> dependencies() const; private: Optional<InstalledPackageView> m_installed_package; diff --git a/toolsrc/include/vcpkg/remove.h b/toolsrc/include/vcpkg/remove.h index 06bdc23f5..faba3e368 100644 --- a/toolsrc/include/vcpkg/remove.h +++ b/toolsrc/include/vcpkg/remove.h @@ -23,7 +23,6 @@ namespace vcpkg::Remove extern const CommandStructure COMMAND_STRUCTURE; - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet); void remove_package(const VcpkgPaths& paths, const PackageSpec& spec, StatusParagraphs* status_db); struct RemoveCommand : Commands::TripletCommand |
