2016-09-18 20:50:08 -07:00
|
|
|
#pragma once
|
|
|
|
|
2017-10-13 18:37:41 -07:00
|
|
|
#include <vcpkg/binaryparagraph.h>
|
|
|
|
|
2017-04-27 17:56:06 -07:00
|
|
|
#include <unordered_map>
|
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
|
|
|
{
|
2017-04-03 15:25:34 -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
|
|
|
{
|
2017-04-03 15:42:26 -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();
|
2017-06-17 02:39:14 -07:00
|
|
|
explicit StatusParagraph(std::unordered_map<std::string, std::string>&& fields);
|
2016-09-18 20:50:08 -07:00
|
|
|
|
2018-01-23 01:56:25 -08: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
|
|
|
};
|
|
|
|
|
2017-04-12 22:48:52 -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);
|
2018-01-23 06:50:24 -08:00
|
|
|
|
|
|
|
struct InstalledPackageView
|
|
|
|
{
|
|
|
|
InstalledPackageView() : core(nullptr) {}
|
|
|
|
|
|
|
|
InstalledPackageView(const StatusParagraph* c, std::vector<const StatusParagraph*>&& fs)
|
|
|
|
: core(c), features(std::move(fs))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<PackageSpec> dependencies() const;
|
|
|
|
|
|
|
|
const StatusParagraph* core;
|
|
|
|
std::vector<const StatusParagraph*> features;
|
|
|
|
};
|
2016-09-18 20:50:08 -07:00
|
|
|
}
|