aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
authorras0219 <533828+ras0219@users.noreply.github.com>2021-02-02 15:00:33 -0800
committerGitHub <noreply@github.com>2021-02-02 15:00:33 -0800
commit5793c4bd9f5d3a8e9087d444beba202e753ec4c9 (patch)
treeda656084cd9fd4685d202b8fd24d852ce7185d84 /toolsrc/include
parent3b4a4e4b5cff58ae9af6b46ad63fda71146f6ce4 (diff)
downloadvcpkg-5793c4bd9f5d3a8e9087d444beba202e753ec4c9.tar.gz
vcpkg-5793c4bd9f5d3a8e9087d444beba202e753ec4c9.zip
[vcpkg] Miscellaneous internal improvements extracted from #15424 (#15677)
* [vcpkg] Miscellaneous internal improvements extracted from #15424 * [vcpkg] CR comments * [armadillo] Use vcpkg_from_git() to workaround gitlab missing archive Co-authored-by: Robert Schumacher <roschuma@microsoft.com> Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/vcpkg-test/util.h6
-rw-r--r--toolsrc/include/vcpkg/base/optional.h26
-rw-r--r--toolsrc/include/vcpkg/dependencies.h2
-rw-r--r--toolsrc/include/vcpkg/remove.h1
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