[vcpkg] Added StatusParagraph::is_installed()
MODIFY
include/vcpkg/statusparagraph.h
include/vcpkg/statusparagraph.h
@@ -32,6 +32,8 @@ namespace vcpkg
StatusParagraph();
explicit StatusParagraph(std::unordered_map<std::string, std::string>&& fields);
+ bool is_installed() const { return want == Want::INSTALL && state == InstallState::INSTALLED; }
+
BinaryParagraph package;
Want want;
InstallState state;

MODIFY
src/vcpkg/statusparagraphs.cpp
src/vcpkg/statusparagraphs.cpp
@@ -48,7 +48,7 @@ namespace vcpkg
const Triplet& triplet) const
{
const const_iterator it = find(name, triplet);
- if (it != end() && (*it)->want == Want::INSTALL && (*it)->state == InstallState::INSTALLED)
+ if (it != end() && (*it)->is_installed())
{
return it;
}

MODIFY
src/vcpkg/vcpkglib.cpp
src/vcpkg/vcpkglib.cpp
@@ -173,7 +173,7 @@ namespace vcpkg
std::vector<StatusParagraph*> installed_packages;
for (auto&& pgh : status_db)
{
- if (pgh->state != InstallState::INSTALLED || pgh->want != Want::INSTALL) continue;
+ if (!pgh->is_installed()) continue;
installed_packages.push_back(pgh.get());
}
@@ -189,7 +189,7 @@ namespace vcpkg
for (const std::unique_ptr<StatusParagraph>& pgh : status_db)
{
- if (pgh->state != InstallState::INSTALLED || !pgh->package.feature.empty())
+ if (!pgh->is_installed() || !pgh->package.feature.empty())
{
continue;
}

[vcpkg] Added StatusParagraph::is_installed()