From bdf80d63c663d6cc512db34be6a96cd9c66aaa99 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 3 Apr 2017 15:02:45 -0700 Subject: [PATCH] triplet -> Triplet --- toolsrc/include/BinaryParagraph.h | 2 +- toolsrc/include/PackageSpec.h | 12 +++++----- toolsrc/include/SourceParagraph.h | 4 ++-- toolsrc/include/StatusParagraphs.h | 6 ++--- toolsrc/include/triplet.h | 28 +++++++++++----------- toolsrc/include/vcpkg_Commands.h | 16 ++++++------- toolsrc/include/vcpkg_Input.h | 4 ++-- toolsrc/include/vcpkg_paths.h | 2 +- toolsrc/src/BinaryParagraph.cpp | 4 ++-- toolsrc/src/PackageSpec.cpp | 8 +++---- toolsrc/src/SourceParagraph.cpp | 4 ++-- toolsrc/src/StatusParagraphs.cpp | 6 ++--- toolsrc/src/commands_build.cpp | 8 +++---- toolsrc/src/commands_build_external.cpp | 2 +- toolsrc/src/commands_ci.cpp | 6 ++--- toolsrc/src/commands_env.cpp | 4 ++-- toolsrc/src/commands_install.cpp | 10 ++++---- toolsrc/src/commands_remove.cpp | 6 ++--- toolsrc/src/tests_dependencies.cpp | 6 ++--- toolsrc/src/tests_paragraph.cpp | 10 ++++---- toolsrc/src/triplet.cpp | 32 ++++++++++++------------- toolsrc/src/vcpkg.cpp | 8 +++---- toolsrc/src/vcpkg_Input.cpp | 4 ++-- toolsrc/src/vcpkg_paths.cpp | 2 +- 24 files changed, 97 insertions(+), 97 deletions(-) diff --git a/toolsrc/include/BinaryParagraph.h b/toolsrc/include/BinaryParagraph.h index f0f7b092ba..d92ae7e6db 100644 --- a/toolsrc/include/BinaryParagraph.h +++ b/toolsrc/include/BinaryParagraph.h @@ -10,7 +10,7 @@ namespace vcpkg { BinaryParagraph(); explicit BinaryParagraph(std::unordered_map fields); - BinaryParagraph(const SourceParagraph& spgh, const triplet& target_triplet); + BinaryParagraph(const SourceParagraph& spgh, const Triplet& target_triplet); std::string displayname() const; diff --git a/toolsrc/include/PackageSpec.h b/toolsrc/include/PackageSpec.h index 4efd7a9ed5..393e32f145 100644 --- a/toolsrc/include/PackageSpec.h +++ b/toolsrc/include/PackageSpec.h @@ -1,19 +1,19 @@ #pragma once #include "PackageSpecParseResult.h" -#include "triplet.h" +#include "Triplet.h" #include "vcpkg_expected.h" namespace vcpkg { struct PackageSpec { - static expected from_string(const std::string& spec_as_string, const triplet& default_target_triplet); + static expected from_string(const std::string& spec_as_string, const Triplet& default_target_triplet); - static expected from_name_and_triplet(const std::string& name, const triplet& target_triplet); + static expected from_name_and_triplet(const std::string& name, const Triplet& target_triplet); const std::string& name() const; - const triplet& target_triplet() const; + const Triplet& target_triplet() const; std::string display_name() const; @@ -23,7 +23,7 @@ namespace vcpkg private: std::string m_name; - triplet m_target_triplet; + Triplet m_target_triplet; }; std::string to_printf_arg(const PackageSpec& spec); @@ -42,7 +42,7 @@ namespace std { size_t hash = 17; hash = hash * 31 + std::hash()(value.name()); - hash = hash * 31 + std::hash()(value.target_triplet()); + hash = hash * 31 + std::hash()(value.target_triplet()); return hash; } }; diff --git a/toolsrc/include/SourceParagraph.h b/toolsrc/include/SourceParagraph.h index 5ae9b38b8a..76b17bd40a 100644 --- a/toolsrc/include/SourceParagraph.h +++ b/toolsrc/include/SourceParagraph.h @@ -5,7 +5,7 @@ namespace vcpkg { - struct triplet; + struct Triplet; struct dependency { @@ -28,7 +28,7 @@ namespace vcpkg std::vector depends; }; - std::vector filter_dependencies(const std::vector& deps, const triplet& t); + std::vector filter_dependencies(const std::vector& deps, const Triplet& t); std::vector expand_qualified_dependencies(const std::vector& depends); std::vector parse_depends(const std::string& depends_string); diff --git a/toolsrc/include/StatusParagraphs.h b/toolsrc/include/StatusParagraphs.h index fc6a96a540..cdf6b8e8e3 100644 --- a/toolsrc/include/StatusParagraphs.h +++ b/toolsrc/include/StatusParagraphs.h @@ -18,9 +18,9 @@ namespace vcpkg { return find(spec.name(), spec.target_triplet()); } - const_iterator find(const std::string& name, const triplet& target_triplet) const; - iterator find(const std::string& name, const triplet& target_triplet); - const_iterator find_installed(const std::string& name, const triplet& target_triplet) const; + const_iterator find(const std::string& name, const Triplet& target_triplet) const; + iterator find(const std::string& name, const Triplet& target_triplet); + const_iterator find_installed(const std::string& name, const Triplet& target_triplet) const; iterator insert(std::unique_ptr); diff --git a/toolsrc/include/triplet.h b/toolsrc/include/triplet.h index 614b3b9091..8cf2413b09 100644 --- a/toolsrc/include/triplet.h +++ b/toolsrc/include/triplet.h @@ -4,15 +4,15 @@ namespace vcpkg { - struct triplet + struct Triplet { - static triplet from_canonical_name(const std::string& triplet_as_string); + static Triplet from_canonical_name(const std::string& triplet_as_string); - static const triplet X86_WINDOWS; - static const triplet X64_WINDOWS; - static const triplet X86_UWP; - static const triplet X64_UWP; - static const triplet ARM_UWP; + static const Triplet X86_WINDOWS; + static const Triplet X64_WINDOWS; + static const Triplet X86_UWP; + static const Triplet X64_UWP; + static const Triplet ARM_UWP; const std::string& canonical_name() const; @@ -24,23 +24,23 @@ namespace vcpkg std::string m_canonical_name; }; - bool operator==(const triplet& left, const triplet& right); + bool operator==(const Triplet& left, const Triplet& right); - bool operator!=(const triplet& left, const triplet& right); + bool operator!=(const Triplet& left, const Triplet& right); - std::string to_string(const triplet& spec); + std::string to_string(const Triplet& spec); - std::string to_printf_arg(const triplet& spec); + std::string to_printf_arg(const Triplet& spec); - std::ostream& operator<<(std::ostream& os, const triplet& spec); + std::ostream& operator<<(std::ostream& os, const Triplet& spec); } namespace std { template <> - struct hash + struct hash { - size_t operator()(const vcpkg::triplet& t) const + size_t operator()(const vcpkg::Triplet& t) const { std::hash hasher; size_t hash = 17; diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 0795a8405f..985657a949 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -8,7 +8,7 @@ namespace vcpkg::Commands { - using command_type_a = void(*)(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); + using command_type_a = void(*)(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const Triplet& default_target_triplet); using command_type_b = void(*)(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); using command_type_c = void(*)(const vcpkg_cmd_arguments& args); @@ -29,32 +29,32 @@ namespace vcpkg::Commands std::string create_error_message(const BuildResult build_result, const PackageSpec& spec); std::string create_user_troubleshooting_message(const PackageSpec& spec); - std::wstring make_build_env_cmd(const triplet& target_triplet, const toolset_t& toolset); + std::wstring make_build_env_cmd(const Triplet& target_triplet, const toolset_t& toolset); BuildResult build_package(const SourceParagraph& source_paragraph, const PackageSpec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const StatusParagraphs& status_db); void perform_and_exit(const PackageSpec& spec, const fs::path& port_dir, const std::unordered_set& options, const vcpkg_paths& paths); - void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const Triplet& default_target_triplet); } namespace BuildExternal { - void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const Triplet& default_target_triplet); } namespace Install { void install_package(const vcpkg_paths& paths, const BinaryParagraph& binary_paragraph, StatusParagraphs* status_db); - void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const Triplet& default_target_triplet); } namespace CI { - void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const Triplet& default_target_triplet); } namespace Remove { - void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const Triplet& default_target_triplet); } namespace Update @@ -73,7 +73,7 @@ namespace vcpkg::Commands namespace Env { - void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_triplet); + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const Triplet& default_triplet); } namespace Create diff --git a/toolsrc/include/vcpkg_Input.h b/toolsrc/include/vcpkg_Input.h index da7bebbfac..5e1d1f0fa9 100644 --- a/toolsrc/include/vcpkg_Input.h +++ b/toolsrc/include/vcpkg_Input.h @@ -7,8 +7,8 @@ namespace vcpkg::Input { PackageSpec check_and_get_package_spec( const std::string& package_spec_as_string, - const triplet& default_target_triplet, + const Triplet& default_target_triplet, CStringView example_text); - void check_triplet(const triplet& t, const vcpkg_paths& paths); + void check_triplet(const Triplet& t, const vcpkg_paths& paths); } diff --git a/toolsrc/include/vcpkg_paths.h b/toolsrc/include/vcpkg_paths.h index fa74fd7030..c6ed34937e 100644 --- a/toolsrc/include/vcpkg_paths.h +++ b/toolsrc/include/vcpkg_paths.h @@ -23,7 +23,7 @@ namespace vcpkg fs::path build_info_file_path(const PackageSpec& spec) const; fs::path listfile_path(const BinaryParagraph& pgh) const; - bool is_valid_triplet(const triplet& t) const; + bool is_valid_triplet(const Triplet& t) const; fs::path root; fs::path packages; diff --git a/toolsrc/src/BinaryParagraph.cpp b/toolsrc/src/BinaryParagraph.cpp index 870082c8b2..42ef0a77aa 100644 --- a/toolsrc/src/BinaryParagraph.cpp +++ b/toolsrc/src/BinaryParagraph.cpp @@ -29,7 +29,7 @@ namespace vcpkg { const std::string name = details::remove_required_field(&fields, BinaryParagraphRequiredField::PACKAGE); const std::string architecture = details::remove_required_field(&fields, BinaryParagraphRequiredField::ARCHITECTURE); - const triplet target_triplet = triplet::from_canonical_name(architecture); + const Triplet target_triplet = Triplet::from_canonical_name(architecture); this->spec = PackageSpec::from_name_and_triplet(name, target_triplet).value_or_exit(VCPKG_LINE_INFO); this->version = details::remove_required_field(&fields, BinaryParagraphRequiredField::VERSION); @@ -44,7 +44,7 @@ namespace vcpkg this->depends = parse_depends(deps); } - BinaryParagraph::BinaryParagraph(const SourceParagraph& spgh, const triplet& target_triplet) + BinaryParagraph::BinaryParagraph(const SourceParagraph& spgh, const Triplet& target_triplet) { this->spec = PackageSpec::from_name_and_triplet(spgh.name, target_triplet).value_or_exit(VCPKG_LINE_INFO); this->version = spgh.version; diff --git a/toolsrc/src/PackageSpec.cpp b/toolsrc/src/PackageSpec.cpp index 225f2ef8ef..4b5928ce76 100644 --- a/toolsrc/src/PackageSpec.cpp +++ b/toolsrc/src/PackageSpec.cpp @@ -8,7 +8,7 @@ namespace vcpkg return (c == '-') || isdigit(c) || (isalpha(c) && islower(c)); } - expected PackageSpec::from_string(const std::string& spec_as_string, const triplet& default_target_triplet) + expected PackageSpec::from_string(const std::string& spec_as_string, const Triplet& default_target_triplet) { auto pos = spec_as_string.find(':'); if (pos == std::string::npos) @@ -23,11 +23,11 @@ namespace vcpkg } const std::string name = spec_as_string.substr(0, pos); - const triplet target_triplet = triplet::from_canonical_name(spec_as_string.substr(pos + 1)); + const Triplet target_triplet = Triplet::from_canonical_name(spec_as_string.substr(pos + 1)); return from_name_and_triplet(name, target_triplet); } - expected PackageSpec::from_name_and_triplet(const std::string& name, const triplet& target_triplet) + expected PackageSpec::from_name_and_triplet(const std::string& name, const Triplet& target_triplet) { if (std::find_if_not(name.cbegin(), name.cend(), is_valid_package_spec_char) != name.end()) { @@ -45,7 +45,7 @@ namespace vcpkg return this->m_name; } - const triplet& PackageSpec::target_triplet() const + const Triplet& PackageSpec::target_triplet() const { return this->m_target_triplet; } diff --git a/toolsrc/src/SourceParagraph.cpp b/toolsrc/src/SourceParagraph.cpp index 3a9d717495..9670a3c989 100644 --- a/toolsrc/src/SourceParagraph.cpp +++ b/toolsrc/src/SourceParagraph.cpp @@ -3,7 +3,7 @@ #include "vcpkglib_helpers.h" #include "vcpkg_System.h" #include "vcpkg_Maps.h" -#include "triplet.h" +#include "Triplet.h" #include "vcpkg_Checks.h" namespace vcpkg @@ -125,7 +125,7 @@ namespace vcpkg return out; } - std::vector filter_dependencies(const std::vector& deps, const triplet& t) + std::vector filter_dependencies(const std::vector& deps, const Triplet& t) { std::vector ret; for (auto&& dep : deps) diff --git a/toolsrc/src/StatusParagraphs.cpp b/toolsrc/src/StatusParagraphs.cpp index 3a5d668426..a153e2b977 100644 --- a/toolsrc/src/StatusParagraphs.cpp +++ b/toolsrc/src/StatusParagraphs.cpp @@ -11,7 +11,7 @@ namespace vcpkg { }; - StatusParagraphs::const_iterator StatusParagraphs::find(const std::string& name, const triplet& target_triplet) const + StatusParagraphs::const_iterator StatusParagraphs::find(const std::string& name, const Triplet& target_triplet) const { return std::find_if(begin(), end(), [&](const std::unique_ptr& pgh) { @@ -20,7 +20,7 @@ namespace vcpkg }); } - StatusParagraphs::iterator StatusParagraphs::find(const std::string& name, const triplet& target_triplet) + StatusParagraphs::iterator StatusParagraphs::find(const std::string& name, const Triplet& target_triplet) { return std::find_if(begin(), end(), [&](const std::unique_ptr& pgh) { @@ -29,7 +29,7 @@ namespace vcpkg }); } - StatusParagraphs::const_iterator StatusParagraphs::find_installed(const std::string& name, const triplet& target_triplet) const + 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_t::install) diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index a757916ca7..91420ec4f4 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -18,14 +18,14 @@ namespace vcpkg::Commands::Build static const std::string OPTION_CHECKS_ONLY = "--checks-only"; - static void create_binary_control_file(const vcpkg_paths& paths, const SourceParagraph& source_paragraph, const triplet& target_triplet) + static void create_binary_control_file(const vcpkg_paths& paths, const SourceParagraph& source_paragraph, const Triplet& target_triplet) { const BinaryParagraph bpgh = BinaryParagraph(source_paragraph, target_triplet); const fs::path binary_control_file = paths.packages / bpgh.dir() / "CONTROL"; std::ofstream(binary_control_file) << bpgh; } - std::wstring make_build_env_cmd(const triplet& target_triplet, const toolset_t& toolset) + std::wstring make_build_env_cmd(const Triplet& target_triplet, const toolset_t& toolset) { return Strings::wformat(LR"("%s" %s >nul 2>&1)", toolset.vcvarsall.native(), @@ -36,7 +36,7 @@ namespace vcpkg::Commands::Build { Checks::check_exit(VCPKG_LINE_INFO, spec.name() == source_paragraph.name, "inconsistent arguments to build_package()"); - const triplet& target_triplet = spec.target_triplet(); + const Triplet& target_triplet = spec.target_triplet(); for (auto&& dep : filter_dependencies(source_paragraph.depends, target_triplet)) { if (status_db.find_installed(dep, target_triplet) == status_db.end()) @@ -174,7 +174,7 @@ namespace vcpkg::Commands::Build Checks::exit_success(VCPKG_LINE_INFO); } - void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const Triplet& default_target_triplet) { static const std::string example = Commands::Help::create_example_string("build zlib:x64-windows"); args.check_exact_arg_count(1, example); // Build only takes a single package and all dependencies must already be installed diff --git a/toolsrc/src/commands_build_external.cpp b/toolsrc/src/commands_build_external.cpp index 3517c76041..2cecc48f24 100644 --- a/toolsrc/src/commands_build_external.cpp +++ b/toolsrc/src/commands_build_external.cpp @@ -5,7 +5,7 @@ namespace vcpkg::Commands::BuildExternal { - void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const Triplet& default_target_triplet) { static const std::string example = Commands::Help::create_example_string(R"(build_external zlib2 C:\path\to\dir\with\controlfile\)"); args.check_exact_arg_count(2, example); diff --git a/toolsrc/src/commands_ci.cpp b/toolsrc/src/commands_ci.cpp index 2fcb39bde9..d94949d4f5 100644 --- a/toolsrc/src/commands_ci.cpp +++ b/toolsrc/src/commands_ci.cpp @@ -14,7 +14,7 @@ namespace vcpkg::Commands::CI using Dependencies::install_plan_type; using Build::BuildResult; - static std::vector load_all_package_specs(const fs::path& ports_directory, const triplet& target_triplet) + static std::vector load_all_package_specs(const fs::path& ports_directory, const Triplet& target_triplet) { std::vector ports = Paragraphs::load_all_ports(ports_directory); std::vector specs; @@ -26,11 +26,11 @@ namespace vcpkg::Commands::CI return specs; } - void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const Triplet& default_target_triplet) { static const std::string example = Commands::Help::create_example_string("ci x64-windows"); args.check_max_arg_count(1, example); - const triplet target_triplet = args.command_arguments.size() == 1 ? triplet::from_canonical_name(args.command_arguments.at(0)) : default_target_triplet; + const Triplet target_triplet = args.command_arguments.size() == 1 ? Triplet::from_canonical_name(args.command_arguments.at(0)) : default_target_triplet; Input::check_triplet(target_triplet, paths); args.check_and_get_optional_command_arguments({}); const std::vector specs = load_all_package_specs(paths.ports, target_triplet); diff --git a/toolsrc/src/commands_env.cpp b/toolsrc/src/commands_env.cpp index 314afb779b..0737973056 100644 --- a/toolsrc/src/commands_env.cpp +++ b/toolsrc/src/commands_env.cpp @@ -4,9 +4,9 @@ namespace vcpkg::Commands::Env { - void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_triplet) + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const Triplet& default_triplet) { - static const std::string example = Commands::Help::create_example_string(R"(env --triplet x64-windows)"); + static const std::string example = Commands::Help::create_example_string(R"(env --Triplet x64-windows)"); args.check_exact_arg_count(0, example); args.check_and_get_optional_command_arguments({}); diff --git a/toolsrc/src/commands_install.cpp b/toolsrc/src/commands_install.cpp index c1c72f6b50..fd586329ff 100644 --- a/toolsrc/src/commands_install.cpp +++ b/toolsrc/src/commands_install.cpp @@ -21,7 +21,7 @@ namespace vcpkg::Commands::Install const fs::path package_prefix_path = paths.package_dir(bpgh.spec); const size_t prefix_length = package_prefix_path.native().size(); - const triplet& target_triplet = bpgh.spec.target_triplet(); + const Triplet& target_triplet = bpgh.spec.target_triplet(); const std::string& target_triplet_as_string = target_triplet.canonical_name(); std::error_code ec; fs::create_directory(paths.installed / target_triplet_as_string, ec); @@ -96,7 +96,7 @@ namespace vcpkg::Commands::Install } }; - static std::vector extract_files_in_triplet(const std::vector& pgh_and_files, const triplet& triplet) + static std::vector extract_files_in_triplet(const std::vector& pgh_and_files, const Triplet& triplet) { std::vector output; for (const StatusParagraph_and_associated_files& t : pgh_and_files) @@ -127,7 +127,7 @@ namespace vcpkg::Commands::Install return SortedVector(std::move(package_files)); } - static SortedVector build_list_of_installed_files(const std::vector& pgh_and_files, const triplet& triplet) + static SortedVector build_list_of_installed_files(const std::vector& pgh_and_files, const Triplet& triplet) { std::vector installed_files = extract_files_in_triplet(pgh_and_files, triplet); const size_t installed_remove_char_count = triplet.canonical_name().size() + 1; // +1 for the slash @@ -139,7 +139,7 @@ namespace vcpkg::Commands::Install void install_package(const vcpkg_paths& paths, const BinaryParagraph& binary_paragraph, StatusParagraphs* status_db) { const fs::path package_dir = paths.package_dir(binary_paragraph.spec); - const triplet& triplet = binary_paragraph.spec.target_triplet(); + const Triplet& triplet = binary_paragraph.spec.target_triplet(); const std::vector pgh_and_files = get_installed_files(paths, *status_db); const SortedVector package_files = build_list_of_package_files(package_dir); @@ -183,7 +183,7 @@ namespace vcpkg::Commands::Install status_db->insert(std::make_unique(spgh)); } - void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const Triplet& default_target_triplet) { // input sanitization static const std::string example = Commands::Help::create_example_string("install zlib zlib:x64-windows curl boost"); diff --git a/toolsrc/src/commands_remove.cpp b/toolsrc/src/commands_remove.cpp index bc82b08b92..a06a719afb 100644 --- a/toolsrc/src/commands_remove.cpp +++ b/toolsrc/src/commands_remove.cpp @@ -162,7 +162,7 @@ namespace vcpkg::Commands::Remove } } - void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_triplet) + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const Triplet& default_target_triplet) { static const std::string OPTION_PURGE = "--purge"; static const std::string OPTION_NO_PURGE = "--no-purge"; @@ -173,7 +173,7 @@ namespace vcpkg::Commands::Remove const std::unordered_set options = args.check_and_get_optional_command_arguments({ OPTION_PURGE, OPTION_NO_PURGE, OPTION_RECURSE, OPTION_DRY_RUN, OPTION_OUTDATED }); StatusParagraphs status_db = database_load_check(paths); - std::vector specs; + std::vector specs; if (options.find(OPTION_OUTDATED) != options.cend()) { args.check_exact_arg_count(0, example); @@ -182,7 +182,7 @@ namespace vcpkg::Commands::Remove else { args.check_min_arg_count(1, example); - specs = Util::fmap(args.command_arguments, [&](auto&& arg) { return Input::check_and_get_package_spec(arg, default_triplet, example); }); + specs = Util::fmap(args.command_arguments, [&](auto&& arg) { return Input::check_and_get_package_spec(arg, default_target_triplet, example); }); for (auto&& spec : specs) Input::check_triplet(spec.target_triplet(), paths); } diff --git a/toolsrc/src/tests_dependencies.cpp b/toolsrc/src/tests_dependencies.cpp index bce1cab0eb..25504d407e 100644 --- a/toolsrc/src/tests_dependencies.cpp +++ b/toolsrc/src/tests_dependencies.cpp @@ -1,6 +1,6 @@ #include "CppUnitTest.h" #include "SourceParagraph.h" -#include "triplet.h" +#include "Triplet.h" #pragma comment(lib,"version") #pragma comment(lib,"winhttp") @@ -25,12 +25,12 @@ namespace UnitTest1 TEST_METHOD(filter_depends) { auto deps = expand_qualified_dependencies(parse_depends("libA [windows], libB, libC [uwp]")); - auto v = filter_dependencies(deps, triplet::X64_WINDOWS); + auto v = filter_dependencies(deps, Triplet::X64_WINDOWS); Assert::AreEqual(size_t(2), v.size()); Assert::AreEqual("libA", v[0].c_str()); Assert::AreEqual("libB", v[1].c_str()); - auto v2 = filter_dependencies(deps, triplet::ARM_UWP); + auto v2 = filter_dependencies(deps, Triplet::ARM_UWP); Assert::AreEqual(size_t(2), v.size()); Assert::AreEqual("libB", v2[0].c_str()); Assert::AreEqual("libC", v2[1].c_str()); diff --git a/toolsrc/src/tests_paragraph.cpp b/toolsrc/src/tests_paragraph.cpp index d61c1632f4..b7e8f87815 100644 --- a/toolsrc/src/tests_paragraph.cpp +++ b/toolsrc/src/tests_paragraph.cpp @@ -350,23 +350,23 @@ namespace UnitTest1 TEST_METHOD(package_spec_parse) { - vcpkg::expected spec = vcpkg::PackageSpec::from_string("zlib", vcpkg::triplet::X86_WINDOWS); + vcpkg::expected spec = vcpkg::PackageSpec::from_string("zlib", vcpkg::Triplet::X86_WINDOWS); Assert::AreEqual(vcpkg::PackageSpecParseResult::SUCCESS, vcpkg::to_package_spec_parse_result(spec.error_code())); Assert::AreEqual("zlib", spec.get()->name().c_str()); - Assert::AreEqual(vcpkg::triplet::X86_WINDOWS.canonical_name(), spec.get()->target_triplet().canonical_name()); + Assert::AreEqual(vcpkg::Triplet::X86_WINDOWS.canonical_name(), spec.get()->target_triplet().canonical_name()); } TEST_METHOD(package_spec_parse_with_arch) { - vcpkg::expected spec = vcpkg::PackageSpec::from_string("zlib:x64-uwp", vcpkg::triplet::X86_WINDOWS); + vcpkg::expected spec = vcpkg::PackageSpec::from_string("zlib:x64-uwp", vcpkg::Triplet::X86_WINDOWS); Assert::AreEqual(vcpkg::PackageSpecParseResult::SUCCESS, vcpkg::to_package_spec_parse_result(spec.error_code())); Assert::AreEqual("zlib", spec.get()->name().c_str()); - Assert::AreEqual(vcpkg::triplet::X64_UWP.canonical_name(), spec.get()->target_triplet().canonical_name()); + Assert::AreEqual(vcpkg::Triplet::X64_UWP.canonical_name(), spec.get()->target_triplet().canonical_name()); } TEST_METHOD(package_spec_parse_with_multiple_colon) { - auto ec = vcpkg::PackageSpec::from_string("zlib:x86-uwp:", vcpkg::triplet::X86_WINDOWS).error_code(); + auto ec = vcpkg::PackageSpec::from_string("zlib:x86-uwp:", vcpkg::Triplet::X86_WINDOWS).error_code(); Assert::AreEqual(vcpkg::PackageSpecParseResult::TOO_MANY_COLONS, vcpkg::to_package_spec_parse_result(ec)); } diff --git a/toolsrc/src/triplet.cpp b/toolsrc/src/triplet.cpp index 173656f7b3..0aacec9a03 100644 --- a/toolsrc/src/triplet.cpp +++ b/toolsrc/src/triplet.cpp @@ -1,64 +1,64 @@ #include "pch.h" -#include "triplet.h" +#include "Triplet.h" #include "vcpkg_Checks.h" #include "vcpkg_Strings.h" namespace vcpkg { - const triplet triplet::X86_WINDOWS = from_canonical_name("x86-windows"); - const triplet triplet::X64_WINDOWS = from_canonical_name("x64-windows"); - const triplet triplet::X86_UWP = from_canonical_name("x86-uwp"); - const triplet triplet::X64_UWP = from_canonical_name("x64-uwp"); - const triplet triplet::ARM_UWP = from_canonical_name("arm-uwp"); + const Triplet Triplet::X86_WINDOWS = from_canonical_name("x86-windows"); + const Triplet Triplet::X64_WINDOWS = from_canonical_name("x64-windows"); + const Triplet Triplet::X86_UWP = from_canonical_name("x86-uwp"); + const Triplet Triplet::X64_UWP = from_canonical_name("x64-uwp"); + const Triplet Triplet::ARM_UWP = from_canonical_name("arm-uwp"); - std::string to_string(const triplet& t) + std::string to_string(const Triplet& t) { return t.canonical_name(); } - std::string to_printf_arg(const triplet& t) + std::string to_printf_arg(const Triplet& t) { return to_string(t); } - bool operator==(const triplet& left, const triplet& right) + bool operator==(const Triplet& left, const Triplet& right) { return left.canonical_name() == right.canonical_name(); } - bool operator!=(const triplet& left, const triplet& right) + bool operator!=(const Triplet& left, const Triplet& right) { return !(left == right); } - std::ostream& operator<<(std::ostream& os, const triplet& t) + std::ostream& operator<<(std::ostream& os, const Triplet& t) { return os << to_string(t); } - triplet triplet::from_canonical_name(const std::string& triplet_as_string) + Triplet Triplet::from_canonical_name(const std::string& triplet_as_string) { const std::string s(Strings::ascii_to_lowercase(triplet_as_string)); auto it = std::find(s.cbegin(), s.cend(), '-'); Checks::check_exit(VCPKG_LINE_INFO, it != s.cend(), "Invalid triplet: %s", triplet_as_string); - triplet t; + Triplet t; t.m_canonical_name = s; return t; } - const std::string& triplet::canonical_name() const + const std::string& Triplet::canonical_name() const { return this->m_canonical_name; } - std::string triplet::architecture() const + std::string Triplet::architecture() const { auto it = std::find(this->m_canonical_name.cbegin(), this->m_canonical_name.cend(), '-'); return std::string(this->m_canonical_name.cbegin(), it); } - std::string triplet::system() const + std::string Triplet::system() const { auto it = std::find(this->m_canonical_name.cbegin(), this->m_canonical_name.cend(), '-'); return std::string(it + 1, this->m_canonical_name.cend()); diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index 6f70607542..4da0a585bc 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -69,21 +69,21 @@ static void inner(const vcpkg_cmd_arguments& args) return command_function(args, paths); } - triplet default_target_triplet; + Triplet default_target_triplet; if (args.target_triplet != nullptr) { - default_target_triplet = triplet::from_canonical_name(*args.target_triplet); + default_target_triplet = Triplet::from_canonical_name(*args.target_triplet); } else { const optional vcpkg_default_triplet_env = System::get_environmental_variable(L"VCPKG_DEFAULT_TRIPLET"); if (auto v = vcpkg_default_triplet_env.get()) { - default_target_triplet = triplet::from_canonical_name(Strings::utf16_to_utf8(*v)); + default_target_triplet = Triplet::from_canonical_name(Strings::utf16_to_utf8(*v)); } else { - default_target_triplet = triplet::X86_WINDOWS; + default_target_triplet = Triplet::X86_WINDOWS; } } diff --git a/toolsrc/src/vcpkg_Input.cpp b/toolsrc/src/vcpkg_Input.cpp index 64e4b869d6..290801b90b 100644 --- a/toolsrc/src/vcpkg_Input.cpp +++ b/toolsrc/src/vcpkg_Input.cpp @@ -6,7 +6,7 @@ namespace vcpkg::Input { - PackageSpec check_and_get_package_spec(const std::string& package_spec_as_string, const triplet& default_target_triplet, CStringView example_text) + PackageSpec check_and_get_package_spec(const std::string& package_spec_as_string, const Triplet& default_target_triplet, CStringView example_text) { const std::string as_lowercase = Strings::ascii_to_lowercase(package_spec_as_string); expected expected_spec = PackageSpec::from_string(as_lowercase, default_target_triplet); @@ -21,7 +21,7 @@ namespace vcpkg::Input Checks::exit_fail(VCPKG_LINE_INFO); } - void check_triplet(const triplet& t, const vcpkg_paths& paths) + void check_triplet(const Triplet& t, const vcpkg_paths& paths) { if (!paths.is_valid_triplet(t)) { diff --git a/toolsrc/src/vcpkg_paths.cpp b/toolsrc/src/vcpkg_paths.cpp index 68ff245e6f..ea97895245 100644 --- a/toolsrc/src/vcpkg_paths.cpp +++ b/toolsrc/src/vcpkg_paths.cpp @@ -211,7 +211,7 @@ namespace vcpkg return this->vcpkg_dir_info / (pgh.fullstem() + ".list"); } - bool vcpkg_paths::is_valid_triplet(const triplet& t) const + bool vcpkg_paths::is_valid_triplet(const Triplet& t) const { auto it = fs::directory_iterator(this->triplets); for (; it != fs::directory_iterator(); ++it)