Want: change enum constants to ALL_UPPER

This commit is contained in:
Alexander Karatarakis 2017-04-03 15:42:26 -07:00
parent 7ca52532c2
commit cf3ee7c2a5
7 changed files with 24 additions and 24 deletions

View File

@ -15,12 +15,12 @@ namespace vcpkg
enum class Want
{
error,
unknown,
install,
hold,
deinstall,
purge
ERROR_STATE,
UNKNOWN,
INSTALL,
HOLD,
DEINSTALL,
PURGE
};
struct StatusParagraph

View File

@ -12,7 +12,7 @@ namespace vcpkg
static const std::string STATUS = "Status";
}
StatusParagraph::StatusParagraph() : want(Want::error), state(InstallState::ERROR_STATE)
StatusParagraph::StatusParagraph() : want(Want::ERROR_STATE), state(InstallState::ERROR_STATE)
{
}
@ -39,16 +39,16 @@ namespace vcpkg
want = [](const std::string& text)
{
if (text == "unknown")
return Want::unknown;
return Want::UNKNOWN;
if (text == "install")
return Want::install;
return Want::INSTALL;
if (text == "hold")
return Want::hold;
return Want::HOLD;
if (text == "deinstall")
return Want::deinstall;
return Want::DEINSTALL;
if (text == "purge")
return Want::purge;
return Want::error;
return Want::PURGE;
return Want::ERROR_STATE;
}(std::string(mark, b));
if (std::distance(b, e) < 4)
@ -82,11 +82,11 @@ namespace vcpkg
{
switch (f)
{
case Want::deinstall: return "deinstall";
case Want::hold: return "hold";
case Want::install: return "install";
case Want::purge: return "purge";
case Want::unknown: return "unknown";
case Want::DEINSTALL: return "deinstall";
case Want::HOLD: return "hold";
case Want::INSTALL: return "install";
case Want::PURGE: return "purge";
case Want::UNKNOWN: return "unknown";
default: return "error";
}
}

View File

@ -32,7 +32,7 @@ namespace vcpkg
StatusParagraphs::const_iterator StatusParagraphs::find_installed(const std::string& name, const Triplet& target_triplet) const
{
const const_iterator it = find(name, target_triplet);
if (it != end() && (*it)->want == Want::install)
if (it != end() && (*it)->want == Want::INSTALL)
{
return it;
}

View File

@ -164,7 +164,7 @@ namespace vcpkg::Commands::Install
StatusParagraph spgh;
spgh.package = binary_paragraph;
spgh.want = Want::install;
spgh.want = Want::INSTALL;
spgh.state = InstallState::HALF_INSTALLED;
for (auto&& dep : spgh.package.depends)
{

View File

@ -31,7 +31,7 @@ namespace vcpkg::Commands::Remove
{
StatusParagraph& pkg = **status_db->find(spec.name(), spec.target_triplet());
pkg.want = Want::purge;
pkg.want = Want::PURGE;
pkg.state = InstallState::HALF_INSTALLED;
write_update(paths, pkg);

View File

@ -66,7 +66,7 @@ namespace vcpkg::Dependencies
};
auto it = status_db.find(spec);
if (it != status_db.end() && (*it)->want == Want::install)
if (it != status_db.end() && (*it)->want == Want::INSTALL)
{
was_examined.emplace(spec, install_plan_action{install_plan_type::ALREADY_INSTALLED, nullopt, nullopt });
continue;
@ -130,7 +130,7 @@ namespace vcpkg::Dependencies
for (const std::unique_ptr<StatusParagraph>& an_installed_package : status_db)
{
if (an_installed_package->want != Want::install)
if (an_installed_package->want != Want::INSTALL)
continue;
if (an_installed_package->package.spec.target_triplet() != spec.target_triplet())
continue;

View File

@ -176,7 +176,7 @@ namespace vcpkg
std::vector<StatusParagraph*> installed_packages;
for (auto&& pgh : status_db)
{
if (pgh->state == InstallState::NOT_INSTALLED && pgh->want == Want::purge)
if (pgh->state != InstallState::INSTALLED || pgh->want != Want::INSTALL)
continue;
installed_packages.push_back(pgh.get());
}