diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2018-04-10 04:48:02 -0700 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2018-04-11 23:48:32 -0700 |
| commit | 8da8f3e5b3cca98e9151d421a91f5c1590a47086 (patch) | |
| tree | 017c658759e5ab3d46c6e39b0060416a82202c3d /toolsrc/include | |
| parent | 9ccad4304edc3ac452b3c295d5ee203c861fcc6f (diff) | |
| download | vcpkg-8da8f3e5b3cca98e9151d421a91f5c1590a47086.tar.gz vcpkg-8da8f3e5b3cca98e9151d421a91f5c1590a47086.zip | |
[vcpkg] Rework dependencies.cpp to improve type safety and error detection
Diffstat (limited to 'toolsrc/include')
| -rw-r--r-- | toolsrc/include/vcpkg/base/optional.h | 6 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/dependencies.h | 3 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/statusparagraph.h | 1 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/vcpkglib.h | 2 |
4 files changed, 9 insertions, 3 deletions
diff --git a/toolsrc/include/vcpkg/base/optional.h b/toolsrc/include/vcpkg/base/optional.h index af2d297a6..b629de9b3 100644 --- a/toolsrc/include/vcpkg/base/optional.h +++ b/toolsrc/include/vcpkg/base/optional.h @@ -64,6 +64,12 @@ namespace vcpkg return std::move(this->m_base.value()); } + T& value_or_exit(const LineInfo& line_info) & + { + this->exit_if_null(line_info); + return this->m_base.value(); + } + const T& value_or_exit(const LineInfo& line_info) const& { this->exit_if_null(line_info); diff --git a/toolsrc/include/vcpkg/dependencies.h b/toolsrc/include/vcpkg/dependencies.h index fea0d88a9..704e76b07 100644 --- a/toolsrc/include/vcpkg/dependencies.h +++ b/toolsrc/include/vcpkg/dependencies.h @@ -37,8 +37,7 @@ namespace vcpkg::Dependencies InstallPlanAction(); - InstallPlanAction(const PackageSpec& spec, - InstalledPackageView&& spghs, + InstallPlanAction(InstalledPackageView&& spghs, const std::set<std::string>& features, const RequestType& request_type); diff --git a/toolsrc/include/vcpkg/statusparagraph.h b/toolsrc/include/vcpkg/statusparagraph.h index 0802de530..16144e467 100644 --- a/toolsrc/include/vcpkg/statusparagraph.h +++ b/toolsrc/include/vcpkg/statusparagraph.h @@ -54,6 +54,7 @@ namespace vcpkg { } + const PackageSpec& spec() const { return core->package.spec; } std::vector<PackageSpec> dependencies() const; const StatusParagraph* core; diff --git a/toolsrc/include/vcpkg/vcpkglib.h b/toolsrc/include/vcpkg/vcpkglib.h index 3c8e676bf..5674d30db 100644 --- a/toolsrc/include/vcpkg/vcpkglib.h +++ b/toolsrc/include/vcpkg/vcpkglib.h @@ -16,7 +16,7 @@ namespace vcpkg SortedVector<std::string> files; }; - std::vector<StatusParagraph*> get_installed_ports(const StatusParagraphs& status_db); + std::vector<InstalledPackageView> get_installed_ports(const StatusParagraphs& status_db); std::vector<StatusParagraphAndAssociatedFiles> get_installed_files(const VcpkgPaths& paths, const StatusParagraphs& status_db); |
