cemu-vcpkg/toolsrc/include/vcpkg/statusparagraph.h

65 lines
1.4 KiB
C
Raw Normal View History

2016-09-18 20:50:08 -07:00
#pragma once
#include <map>
2016-09-18 20:50:08 -07:00
#include <vcpkg/binaryparagraph.h>
2016-09-18 20:50:08 -07:00
namespace vcpkg
{
2017-04-03 15:14:17 -07:00
enum class InstallState
2016-09-18 20:50:08 -07:00
{
ERROR_STATE,
NOT_INSTALLED,
HALF_INSTALLED,
INSTALLED,
2016-09-18 20:50:08 -07:00
};
2017-04-03 15:25:53 -07:00
enum class Want
2016-09-18 20:50:08 -07:00
{
ERROR_STATE,
UNKNOWN,
INSTALL,
HOLD,
DEINSTALL,
PURGE
2016-09-18 20:50:08 -07:00
};
2017-05-24 15:54:12 -07:00
/// <summary>
/// Installed package metadata
/// </summary>
2016-09-18 20:50:08 -07:00
struct StatusParagraph
{
StatusParagraph() noexcept;
explicit StatusParagraph(Parse::Paragraph&& fields);
2016-09-18 20:50:08 -07:00
bool is_installed() const { return want == Want::INSTALL && state == InstallState::INSTALLED; }
2016-09-18 20:50:08 -07:00
BinaryParagraph package;
2017-04-03 15:25:53 -07:00
Want want;
2017-04-03 15:14:17 -07:00
InstallState state;
2016-09-18 20:50:08 -07:00
};
void serialize(const StatusParagraph& pgh, std::string& out_str);
2016-09-18 20:50:08 -07:00
2017-04-03 15:14:17 -07:00
std::string to_string(InstallState f);
2016-09-18 20:50:08 -07:00
2017-04-03 15:25:53 -07:00
std::string to_string(Want f);
struct InstalledPackageView
{
InstalledPackageView() noexcept : core(nullptr) { }
InstalledPackageView(const StatusParagraph* c, std::vector<const StatusParagraph*>&& fs)
: core(c), features(std::move(fs))
{
}
const PackageSpec& spec() const { return core->package.spec; }
std::vector<PackageSpec> dependencies() const;
std::map<std::string, std::vector<FeatureSpec>> feature_dependencies() const;
const StatusParagraph* core;
std::vector<const StatusParagraph*> features;
};
2016-09-18 20:50:08 -07:00
}