From 4a8b2ed1cd91dd41c728f4ba03ee525e73bdfef4 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 3 Apr 2017 16:24:44 -0700 Subject: [PATCH] package_spec_with_remove_plan -> PackageSpecWithRemovePlan --- toolsrc/include/vcpkg_Dependencies.h | 6 +++--- toolsrc/src/commands_remove.cpp | 24 ++++++++++++------------ toolsrc/src/vcpkg_Dependencies.cpp | 8 ++++---- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h index d074128372..b734295fcc 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg_Dependencies.h @@ -65,9 +65,9 @@ namespace vcpkg::Dependencies RequestType request_type; }; - struct package_spec_with_remove_plan + struct PackageSpecWithRemovePlan { - package_spec_with_remove_plan(const PackageSpec& spec, RemovePlanAction&& plan); + PackageSpecWithRemovePlan(const PackageSpec& spec, RemovePlanAction&& plan); PackageSpec spec; RemovePlanAction plan; @@ -75,5 +75,5 @@ namespace vcpkg::Dependencies std::vector create_install_plan(const vcpkg_paths& paths, const std::vector& specs, const StatusParagraphs& status_db); - std::vector create_remove_plan(const std::vector& specs, const StatusParagraphs& status_db); + std::vector create_remove_plan(const std::vector& specs, const StatusParagraphs& status_db); } diff --git a/toolsrc/src/commands_remove.cpp b/toolsrc/src/commands_remove.cpp index 20068bc78a..5feaaf6476 100644 --- a/toolsrc/src/commands_remove.cpp +++ b/toolsrc/src/commands_remove.cpp @@ -8,7 +8,7 @@ namespace vcpkg::Commands::Remove { - using Dependencies::package_spec_with_remove_plan; + using Dependencies::PackageSpecWithRemovePlan; using Dependencies::RemovePlanType; using Dependencies::RequestType; using Update::OutdatedPackage; @@ -101,20 +101,20 @@ namespace vcpkg::Commands::Remove write_update(paths, pkg); } - static void sort_packages_by_name(std::vector* packages) + static void sort_packages_by_name(std::vector* packages) { - std::sort(packages->begin(), packages->end(), [](const package_spec_with_remove_plan* left, const package_spec_with_remove_plan* right) -> bool + std::sort(packages->begin(), packages->end(), [](const PackageSpecWithRemovePlan* left, const PackageSpecWithRemovePlan* right) -> bool { return left->spec.name() < right->spec.name(); }); } - static void print_plan(const std::vector& plan) + static void print_plan(const std::vector& plan) { - std::vector not_installed; - std::vector remove; + std::vector not_installed; + std::vector remove; - for (const package_spec_with_remove_plan& i : plan) + for (const PackageSpecWithRemovePlan& i : plan) { if (i.plan.plan_type == RemovePlanType::NOT_INSTALLED) { @@ -135,7 +135,7 @@ namespace vcpkg::Commands::Remove { sort_packages_by_name(¬_installed); System::println("The following packages are not installed, so not removed:\n%s", - Strings::join("\n ", not_installed, [](const package_spec_with_remove_plan* p) + Strings::join("\n ", not_installed, [](const PackageSpecWithRemovePlan* p) { return " " + p->spec.toString(); })); @@ -145,7 +145,7 @@ namespace vcpkg::Commands::Remove { sort_packages_by_name(&remove); System::println("The following packages will be removed:\n%s", - Strings::join("\n", remove, [](const package_spec_with_remove_plan* p) + Strings::join("\n", remove, [](const PackageSpecWithRemovePlan* p) { if (p->plan.request_type == Dependencies::RequestType::AUTO_SELECTED) { @@ -198,12 +198,12 @@ namespace vcpkg::Commands::Remove const bool isRecursive = options.find(OPTION_RECURSE) != options.cend(); const bool dryRun = options.find(OPTION_DRY_RUN) != options.cend(); - const std::vector remove_plan = Dependencies::create_remove_plan(specs, status_db); + const std::vector remove_plan = Dependencies::create_remove_plan(specs, status_db); Checks::check_exit(VCPKG_LINE_INFO, !remove_plan.empty(), "Remove plan cannot be empty"); print_plan(remove_plan); - const bool has_non_user_requested_packages = std::find_if(remove_plan.cbegin(), remove_plan.cend(), [](const package_spec_with_remove_plan& package)-> bool + const bool has_non_user_requested_packages = std::find_if(remove_plan.cbegin(), remove_plan.cend(), [](const PackageSpecWithRemovePlan& package)-> bool { return package.plan.request_type != RequestType::USER_REQUESTED; }) != remove_plan.cend(); @@ -224,7 +224,7 @@ namespace vcpkg::Commands::Remove Checks::exit_success(VCPKG_LINE_INFO); } - for (const package_spec_with_remove_plan& action : remove_plan) + for (const PackageSpecWithRemovePlan& action : remove_plan) { const std::string display_name = action.spec.display_name(); diff --git a/toolsrc/src/vcpkg_Dependencies.cpp b/toolsrc/src/vcpkg_Dependencies.cpp index a5fec43b74..dcbbe1f50e 100644 --- a/toolsrc/src/vcpkg_Dependencies.cpp +++ b/toolsrc/src/vcpkg_Dependencies.cpp @@ -30,7 +30,7 @@ namespace vcpkg::Dependencies { } - package_spec_with_remove_plan::package_spec_with_remove_plan(const PackageSpec& spec, RemovePlanAction&& plan) + PackageSpecWithRemovePlan::PackageSpecWithRemovePlan(const PackageSpec& spec, RemovePlanAction&& plan) : spec(spec), plan(std::move(plan)) { } @@ -102,7 +102,7 @@ namespace vcpkg::Dependencies return ret; } - std::vector create_remove_plan(const std::vector& specs, const StatusParagraphs& status_db) + std::vector create_remove_plan(const std::vector& specs, const StatusParagraphs& status_db) { std::unordered_set specs_as_set(specs.cbegin(), specs.cend()); @@ -149,12 +149,12 @@ namespace vcpkg::Dependencies was_examined.emplace(spec, RemovePlanAction(RemovePlanType::REMOVE, request_type)); } - std::vector ret; + std::vector ret; const std::vector pkgs = graph.find_topological_sort(); for (const PackageSpec& pkg : pkgs) { - ret.push_back(package_spec_with_remove_plan(pkg, std::move(was_examined[pkg]))); + ret.push_back(PackageSpecWithRemovePlan(pkg, std::move(was_examined[pkg]))); } return ret; }