diff options
| author | Patrick Bader <mail@patrickbader.eu> | 2017-01-06 19:09:17 +0100 |
|---|---|---|
| committer | Patrick Bader <mail@patrickbader.eu> | 2017-01-06 19:09:17 +0100 |
| commit | 04f8da985c9acdd090055ad06bcf75eb20af1987 (patch) | |
| tree | 76ae8c42d498f0c2d607c891eac50f41f06d1269 | |
| parent | 44c86f56db351da15e5a2b2fcca62656ab8cccbf (diff) | |
| parent | ff10939203b7694f21d8e8e0464f092dff1b4eb0 (diff) | |
| download | vcpkg-04f8da985c9acdd090055ad06bcf75eb20af1987.tar.gz vcpkg-04f8da985c9acdd090055ad06bcf75eb20af1987.zip | |
Merge branch 'master' of https://github.com/Microsoft/vcpkg
37 files changed, 144 insertions, 79 deletions
diff --git a/toolsrc/include/BuildInfo.h b/toolsrc/include/BuildInfo.h index 49811d521..c90ad7a4e 100644 --- a/toolsrc/include/BuildInfo.h +++ b/toolsrc/include/BuildInfo.h @@ -4,7 +4,7 @@ #include "Paragraphs.h" #include <regex> -namespace vcpkg { namespace PostBuildLint +namespace vcpkg::PostBuildLint { enum class LinkageType { @@ -126,4 +126,4 @@ namespace vcpkg { namespace PostBuildLint }; BuildInfo read_build_info(const fs::path& filepath); -}} +} diff --git a/toolsrc/include/ImmutableSortedVector.h b/toolsrc/include/ImmutableSortedVector.h new file mode 100644 index 000000000..681f9fd4d --- /dev/null +++ b/toolsrc/include/ImmutableSortedVector.h @@ -0,0 +1,48 @@ +#pragma once + +#include <vector> +#include <algorithm> + +// Add more forwarding functions to the delegate std::vector as needed. +namespace vcpkg +{ + template <class T> + class ImmutableSortedVector + { + public: + static ImmutableSortedVector<T> create(std::vector<T> vector) + { + ImmutableSortedVector out; + out.delegate = std::move(vector); + if (!std::is_sorted(out.delegate.cbegin(), out.delegate.cend())) + { + std::sort(out.delegate.begin(), out.delegate.end()); + } + + return out; + } + + typename std::vector<T>::const_iterator begin() const + { + return this->delegate.cbegin(); + } + + typename std::vector<T>::const_iterator end() const + { + return this->delegate.cend(); + } + + typename std::vector<T>::const_iterator cbegin() const + { + return this->delegate.cbegin(); + } + + typename std::vector<T>::const_iterator cend() const + { + return this->delegate.cend(); + } + + private: + std::vector<T> delegate; + }; +} diff --git a/toolsrc/include/Paragraphs.h b/toolsrc/include/Paragraphs.h index 9e9fafe49..761b49759 100644 --- a/toolsrc/include/Paragraphs.h +++ b/toolsrc/include/Paragraphs.h @@ -3,8 +3,8 @@ #include "filesystem_fs.h" #include <unordered_map> -namespace vcpkg { namespace Paragraphs +namespace vcpkg::Paragraphs { std::vector<std::unordered_map<std::string, std::string>> get_paragraphs(const fs::path& control_path); std::vector<std::unordered_map<std::string, std::string>> parse_paragraphs(const std::string& str); -}} +} diff --git a/toolsrc/include/coff_file_reader.h b/toolsrc/include/coff_file_reader.h index edf6910a5..24fbf4576 100644 --- a/toolsrc/include/coff_file_reader.h +++ b/toolsrc/include/coff_file_reader.h @@ -3,7 +3,7 @@ #include "MachineType.h" #include "filesystem_fs.h" -namespace vcpkg {namespace COFFFileReader +namespace vcpkg::COFFFileReader { struct dll_info { @@ -18,4 +18,4 @@ namespace vcpkg {namespace COFFFileReader dll_info read_dll(const fs::path& path); lib_info read_lib(const fs::path& path); -}} +} diff --git a/toolsrc/include/post_build_lint.h b/toolsrc/include/post_build_lint.h index a5fb9149f..215a237aa 100644 --- a/toolsrc/include/post_build_lint.h +++ b/toolsrc/include/post_build_lint.h @@ -2,7 +2,7 @@ #include "package_spec.h" #include "vcpkg_paths.h" -namespace vcpkg {namespace PostBuildLint +namespace vcpkg::PostBuildLint { void perform_all_checks(const package_spec& spec, const vcpkg_paths& paths); -}} +} diff --git a/toolsrc/include/vcpkg.h b/toolsrc/include/vcpkg.h index 75dc40b43..b1653d197 100644 --- a/toolsrc/include/vcpkg.h +++ b/toolsrc/include/vcpkg.h @@ -4,6 +4,7 @@ #include "BinaryParagraph.h" #include "StatusParagraphs.h" #include "vcpkg_paths.h" +#include "ImmutableSortedVector.h" namespace vcpkg { @@ -14,7 +15,7 @@ namespace vcpkg struct StatusParagraph_and_associated_files { StatusParagraph pgh; - std::vector<std::string> files; + ImmutableSortedVector<std::string> files; }; std::vector<StatusParagraph_and_associated_files> get_installed_files(const vcpkg_paths& paths, const StatusParagraphs& status_db); diff --git a/toolsrc/include/vcpkg_Checks.h b/toolsrc/include/vcpkg_Checks.h index 9d9b21ed6..a58b38ac0 100644 --- a/toolsrc/include/vcpkg_Checks.h +++ b/toolsrc/include/vcpkg_Checks.h @@ -2,7 +2,7 @@ #include "vcpkg_Strings.h" -namespace vcpkg {namespace Checks +namespace vcpkg::Checks { __declspec(noreturn) void unreachable(); @@ -46,4 +46,4 @@ namespace vcpkg {namespace Checks exit_with_message(Strings::format(errorMessageTemplate, errorMessageArgs...).c_str()); } } -}} +} diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h index 3616e6be9..4da9de694 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg_Dependencies.h @@ -4,7 +4,7 @@ #include "StatusParagraphs.h" #include "vcpkg_paths.h" -namespace vcpkg {namespace Dependencies +namespace vcpkg::Dependencies { enum class install_plan_type { @@ -27,4 +27,4 @@ namespace vcpkg {namespace Dependencies }; std::vector<package_spec_with_install_plan> create_install_plan(const vcpkg_paths& paths, const std::vector<package_spec>& specs, const StatusParagraphs& status_db); -}} +} diff --git a/toolsrc/include/vcpkg_Environment.h b/toolsrc/include/vcpkg_Environment.h index 877ac7deb..1e8624d89 100644 --- a/toolsrc/include/vcpkg_Environment.h +++ b/toolsrc/include/vcpkg_Environment.h @@ -1,7 +1,7 @@ #pragma once #include "vcpkg_paths.h" -namespace vcpkg {namespace Environment +namespace vcpkg::Environment { void ensure_nuget_on_path(const vcpkg_paths& paths); @@ -14,4 +14,4 @@ namespace vcpkg {namespace Environment ensure_cmake_on_path(paths); ensure_git_on_path(paths); } -}} +} diff --git a/toolsrc/include/vcpkg_Files.h b/toolsrc/include/vcpkg_Files.h index 6c9d0d365..3f9570946 100644 --- a/toolsrc/include/vcpkg_Files.h +++ b/toolsrc/include/vcpkg_Files.h @@ -4,7 +4,7 @@ #include "filesystem_fs.h" #include <iterator> -namespace vcpkg {namespace Files +namespace vcpkg::Files { static const char* FILESYSTEM_INVALID_CHARACTERS = R"(\/:*?"<>|)"; @@ -53,4 +53,4 @@ namespace vcpkg {namespace Files std::vector<fs::path> non_recursive_find_all_files_in_dir(const fs::path& dir); void print_paths(const std::vector<fs::path>& paths); -}} +} diff --git a/toolsrc/include/vcpkg_Graphs.h b/toolsrc/include/vcpkg_Graphs.h index 9444ac45b..933d9ac67 100644 --- a/toolsrc/include/vcpkg_Graphs.h +++ b/toolsrc/include/vcpkg_Graphs.h @@ -3,7 +3,7 @@ #include <unordered_map> #include <unordered_set> -namespace vcpkg { namespace Graphs +namespace vcpkg::Graphs { enum class ExplorationStatus { @@ -117,4 +117,4 @@ namespace vcpkg { namespace Graphs private: std::unordered_map<V, std::unordered_set<V>> vertices; }; -}} +} diff --git a/toolsrc/include/vcpkg_Input.h b/toolsrc/include/vcpkg_Input.h index 5ce90e3b9..96cbeecc3 100644 --- a/toolsrc/include/vcpkg_Input.h +++ b/toolsrc/include/vcpkg_Input.h @@ -3,7 +3,7 @@ #include "package_spec.h" #include "vcpkg_paths.h" -namespace vcpkg {namespace Input +namespace vcpkg::Input { package_spec check_and_get_package_spec(const std::string& package_spec_as_string, const triplet& default_target_triplet, const std::string& example_text); @@ -11,5 +11,5 @@ namespace vcpkg {namespace Input void check_triplet(const triplet& t, const vcpkg_paths& paths); - void check_triplets(std::vector<package_spec> triplets, const vcpkg_paths& paths); -}} + void check_triplets(const std::vector<package_spec>& triplets, const vcpkg_paths& paths); +} diff --git a/toolsrc/include/vcpkg_Maps.h b/toolsrc/include/vcpkg_Maps.h index c67462a39..5e2f92f55 100644 --- a/toolsrc/include/vcpkg_Maps.h +++ b/toolsrc/include/vcpkg_Maps.h @@ -4,7 +4,7 @@ #include <unordered_set> #include <map> -namespace vcpkg { namespace Maps +namespace vcpkg::Maps { template <typename K, typename V> std::unordered_set<K> extract_key_set(const std::unordered_map<K, V>& input_map) @@ -38,4 +38,4 @@ namespace vcpkg { namespace Maps } return key_set; } -}} +} diff --git a/toolsrc/include/vcpkg_Sets.h b/toolsrc/include/vcpkg_Sets.h index 7b330f31c..6dec95b89 100644 --- a/toolsrc/include/vcpkg_Sets.h +++ b/toolsrc/include/vcpkg_Sets.h @@ -3,7 +3,7 @@ #include "vcpkg_Checks.h" #include <unordered_set> -namespace vcpkg { namespace Sets +namespace vcpkg::Sets { template <typename T, typename Container> void remove_all(std::unordered_set<T>* input_set, Container remove_these) @@ -14,4 +14,4 @@ namespace vcpkg { namespace Sets input_set->erase(r); } } -}} +} diff --git a/toolsrc/include/vcpkg_Strings.h b/toolsrc/include/vcpkg_Strings.h index a117a1a81..28853cb5d 100644 --- a/toolsrc/include/vcpkg_Strings.h +++ b/toolsrc/include/vcpkg_Strings.h @@ -2,7 +2,7 @@ #include <vector> -namespace vcpkg {namespace Strings {namespace details +namespace vcpkg::Strings::details { inline const char* to_printf_arg(const std::string& s) { @@ -42,9 +42,9 @@ namespace vcpkg {namespace Strings {namespace details } std::wstring wformat_internal(const wchar_t* fmtstr, ...); -}}} +} -namespace vcpkg {namespace Strings +namespace vcpkg::Strings { template <class...Args> std::string format(const char* fmtstr, const Args&...args) @@ -75,4 +75,4 @@ namespace vcpkg {namespace Strings std::string trimmed(const std::string& s); void trim_all_and_remove_whitespace_strings(std::vector<std::string>* strings); -}} +} diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h index 1101c9b27..c9195163c 100644 --- a/toolsrc/include/vcpkg_System.h +++ b/toolsrc/include/vcpkg_System.h @@ -3,7 +3,7 @@ #include "vcpkg_Strings.h" #include "filesystem_fs.h" -namespace vcpkg {namespace System +namespace vcpkg::System { fs::path get_exe_path_of_current_process(); @@ -93,4 +93,4 @@ namespace vcpkg {namespace System }; std::wstring wdupenv_str(const wchar_t* varname) noexcept; -}} +} diff --git a/toolsrc/include/vcpkg_info.h b/toolsrc/include/vcpkg_info.h index 01da06307..5380e0158 100644 --- a/toolsrc/include/vcpkg_info.h +++ b/toolsrc/include/vcpkg_info.h @@ -2,9 +2,9 @@ #include <string> -namespace vcpkg { namespace Info +namespace vcpkg::Info { const std::string& version(); const std::string& email(); -}} +} diff --git a/toolsrc/include/vcpkglib_helpers.h b/toolsrc/include/vcpkglib_helpers.h index 019bb8c39..8a08513f3 100644 --- a/toolsrc/include/vcpkglib_helpers.h +++ b/toolsrc/include/vcpkglib_helpers.h @@ -2,7 +2,7 @@ #include <unordered_map> -namespace vcpkg {namespace details +namespace vcpkg::details { std::string optional_field(const std::unordered_map<std::string, std::string>& fields, const std::string& fieldname); std::string remove_optional_field(std::unordered_map<std::string, std::string>* fields, const std::string& fieldname); @@ -11,4 +11,4 @@ namespace vcpkg {namespace details std::string remove_required_field(std::unordered_map<std::string, std::string>* fields, const std::string& fieldname); std::string shorten_description(const std::string& desc); -}} +} diff --git a/toolsrc/src/BuildInfo.cpp b/toolsrc/src/BuildInfo.cpp index f151a3ea5..a45dc4b72 100644 --- a/toolsrc/src/BuildInfo.cpp +++ b/toolsrc/src/BuildInfo.cpp @@ -2,7 +2,7 @@ #include "vcpkg_Checks.h" #include "vcpkglib_helpers.h" -namespace vcpkg { namespace PostBuildLint +namespace vcpkg::PostBuildLint { const ConfigurationType& BuildType::config() const { @@ -161,4 +161,4 @@ namespace vcpkg { namespace PostBuildLint { return this->m_dll_name; } -}} +} diff --git a/toolsrc/src/Paragraphs.cpp b/toolsrc/src/Paragraphs.cpp index 823b4a85e..d99ad45cf 100644 --- a/toolsrc/src/Paragraphs.cpp +++ b/toolsrc/src/Paragraphs.cpp @@ -1,7 +1,7 @@ #include "Paragraphs.h" #include "vcpkg_Files.h" -namespace vcpkg { namespace Paragraphs +namespace vcpkg::Paragraphs { struct Parser { @@ -160,4 +160,4 @@ namespace vcpkg { namespace Paragraphs { return Parser(str.c_str(), str.c_str() + str.size()).get_paragraphs(); } -}} +} diff --git a/toolsrc/src/coff_file_reader.cpp b/toolsrc/src/coff_file_reader.cpp index 1f30ea70b..8ce714bbe 100644 --- a/toolsrc/src/coff_file_reader.cpp +++ b/toolsrc/src/coff_file_reader.cpp @@ -6,7 +6,7 @@ using namespace std; -namespace vcpkg { namespace COFFFileReader +namespace vcpkg::COFFFileReader { template <class T> static T reinterpret_bytes(const char* data) @@ -306,4 +306,4 @@ namespace vcpkg { namespace COFFFileReader return {std::vector<MachineType>(machine_types.cbegin(), machine_types.cend())}; } -}} +} diff --git a/toolsrc/src/commands_installation.cpp b/toolsrc/src/commands_installation.cpp index 8d940bc9d..c239bf06c 100644 --- a/toolsrc/src/commands_installation.cpp +++ b/toolsrc/src/commands_installation.cpp @@ -164,9 +164,8 @@ namespace vcpkg return output; } - void install_package(const vcpkg_paths& paths, const BinaryParagraph& binary_paragraph, StatusParagraphs& status_db) + static ImmutableSortedVector<std::string> build_list_of_package_files(const fs::path& package_dir) { - const fs::path package_dir = paths.package_dir(binary_paragraph.spec); const std::vector<fs::path> package_file_paths = Files::recursive_find_all_files_in_dir(package_dir); std::vector<std::string> package_files; const size_t package_remove_char_count = package_dir.generic_string().size() + 1; // +1 for the slash @@ -176,14 +175,27 @@ namespace vcpkg as_string.erase(0, package_remove_char_count); return std::move(as_string); }); - std::sort(package_files.begin(), package_files.end()); - const std::vector<StatusParagraph_and_associated_files>& pgh_and_files = get_installed_files(paths, status_db); - const triplet& triplet = binary_paragraph.spec.target_triplet(); + return ImmutableSortedVector<std::string>::create(std::move(package_files)); + } + + static ImmutableSortedVector<std::string> build_list_of_installed_files(const std::vector<StatusParagraph_and_associated_files>& pgh_and_files, const triplet& triplet) + { std::vector<std::string> 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 remove_first_n_chars(&installed_files, installed_remove_char_count); - std::sort(installed_files.begin(), installed_files.end()); // Should already be sorted + + return ImmutableSortedVector<std::string>::create(std::move(installed_files)); + } + + 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 std::vector<StatusParagraph_and_associated_files> pgh_and_files = get_installed_files(paths, status_db); + + const ImmutableSortedVector<std::string> package_files = build_list_of_package_files(package_dir); + const ImmutableSortedVector<std::string> installed_files = build_list_of_installed_files(pgh_and_files, triplet); std::vector<std::string> intersection; std::set_intersection(package_files.cbegin(), package_files.cend(), diff --git a/toolsrc/src/metrics.cpp b/toolsrc/src/metrics.cpp index 51c7179c8..1806dad87 100644 --- a/toolsrc/src/metrics.cpp +++ b/toolsrc/src/metrics.cpp @@ -237,13 +237,13 @@ true std::wstring GetSQMUser() { - LONG err = NULL; + LONG err; struct RAII_HKEY { - HKEY hkey = NULL; + HKEY hkey = nullptr; ~RAII_HKEY() { - if (hkey != NULL) + if (hkey != nullptr) RegCloseKey(hkey); } } HKCU_SQMClient; @@ -257,7 +257,7 @@ true std::array<wchar_t,128> buffer; DWORD lType = 0; DWORD dwBufferSize = static_cast<DWORD>(buffer.size() * sizeof(wchar_t)); - err = RegQueryValueExW(HKCU_SQMClient.hkey, L"UserId", NULL, &lType, reinterpret_cast<LPBYTE>(buffer.data()), &dwBufferSize); + err = RegQueryValueExW(HKCU_SQMClient.hkey, L"UserId", nullptr, &lType, reinterpret_cast<LPBYTE>(buffer.data()), &dwBufferSize); if (err == ERROR_SUCCESS && lType == REG_SZ && dwBufferSize >= sizeof(wchar_t)) { size_t sz = dwBufferSize / sizeof(wchar_t); diff --git a/toolsrc/src/post_build_lint.cpp b/toolsrc/src/post_build_lint.cpp index 4f0adf677..1fca3a2f6 100644 --- a/toolsrc/src/post_build_lint.cpp +++ b/toolsrc/src/post_build_lint.cpp @@ -7,7 +7,7 @@ #include "BuildInfo.h" #include <regex> -namespace vcpkg { namespace PostBuildLint +namespace vcpkg::PostBuildLint { enum class lint_status { @@ -668,4 +668,4 @@ namespace vcpkg { namespace PostBuildLint System::println("-- Performing post-build validation done"); } -}} +} diff --git a/toolsrc/src/tests_paragraph.cpp b/toolsrc/src/tests_paragraph.cpp index 6d9e46fcf..fb20eee82 100644 --- a/toolsrc/src/tests_paragraph.cpp +++ b/toolsrc/src/tests_paragraph.cpp @@ -7,14 +7,14 @@ using namespace Microsoft::VisualStudio::CppUnitTestFramework; -namespace Microsoft { namespace VisualStudio { namespace CppUnitTestFramework +namespace Microsoft::VisualStudio::CppUnitTestFramework { template <> inline std::wstring ToString<vcpkg::package_spec_parse_result>(const vcpkg::package_spec_parse_result& t) { return ToString(static_cast<uint32_t>(t)); } -}}} +} namespace UnitTest1 { diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index 4748aeb54..eb2184ccb 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -204,7 +204,7 @@ std::vector<StatusParagraph_and_associated_files> vcpkg::get_installed_files(con } ), installed_files_of_current_pgh.end()); - StatusParagraph_and_associated_files pgh_and_files = {*pgh, std::move(installed_files_of_current_pgh)}; + StatusParagraph_and_associated_files pgh_and_files = {*pgh, ImmutableSortedVector<std::string>::create(std::move(installed_files_of_current_pgh))}; installed_files.push_back(std::move(pgh_and_files)); } diff --git a/toolsrc/src/vcpkg_Checks.cpp b/toolsrc/src/vcpkg_Checks.cpp index 817ac9e96..46b28e55c 100644 --- a/toolsrc/src/vcpkg_Checks.cpp +++ b/toolsrc/src/vcpkg_Checks.cpp @@ -3,7 +3,7 @@ #include <stdexcept> #include "vcpkg_System.h" -namespace vcpkg {namespace Checks +namespace vcpkg::Checks { void unreachable() { @@ -41,4 +41,4 @@ namespace vcpkg {namespace Checks exit_with_message(errorMessage); } } -}} +} diff --git a/toolsrc/src/vcpkg_Dependencies.cpp b/toolsrc/src/vcpkg_Dependencies.cpp index ae7f697fa..f1464a605 100644 --- a/toolsrc/src/vcpkg_Dependencies.cpp +++ b/toolsrc/src/vcpkg_Dependencies.cpp @@ -9,7 +9,7 @@ #include "vcpkg_Files.h" #include "vcpkg.h" -namespace vcpkg { namespace Dependencies +namespace vcpkg::Dependencies { std::vector<package_spec_with_install_plan> create_install_plan(const vcpkg_paths& paths, const std::vector<package_spec>& specs, const StatusParagraphs& status_db) { @@ -72,4 +72,4 @@ namespace vcpkg { namespace Dependencies } return ret; } -}} +} diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index ed70e6881..c7eec3bd0 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -5,7 +5,7 @@ #include "metrics.h" #include "vcpkg_System.h" -namespace vcpkg {namespace Environment +namespace vcpkg::Environment { static const fs::path default_cmake_installation_dir = "C:/Program Files/CMake/bin"; static const fs::path default_cmake_installation_dir_x86 = "C:/Program Files (x86)/CMake/bin"; @@ -83,4 +83,4 @@ namespace vcpkg {namespace Environment // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned ensure_on_path(nuget_version, L"nuget 2>&1", L"powershell -ExecutionPolicy Bypass scripts\\fetchDependency.ps1 -Dependency nuget"); } -}} +} diff --git a/toolsrc/src/vcpkg_Files.cpp b/toolsrc/src/vcpkg_Files.cpp index 48283e43f..1d4faa773 100644 --- a/toolsrc/src/vcpkg_Files.cpp +++ b/toolsrc/src/vcpkg_Files.cpp @@ -3,7 +3,7 @@ #include <regex> #include "vcpkg_System.h" -namespace vcpkg {namespace Files +namespace vcpkg::Files { static const std::regex FILESYSTEM_INVALID_CHARACTERS_REGEX = std::regex(R"([\/:*?"<>|])"); @@ -140,4 +140,4 @@ namespace vcpkg {namespace Files } System::println(""); } -}} +} diff --git a/toolsrc/src/vcpkg_Input.cpp b/toolsrc/src/vcpkg_Input.cpp index 29d487fdb..365f28cdb 100644 --- a/toolsrc/src/vcpkg_Input.cpp +++ b/toolsrc/src/vcpkg_Input.cpp @@ -3,7 +3,7 @@ #include "metrics.h" #include "vcpkg_Commands.h" -namespace vcpkg {namespace Input +namespace vcpkg::Input { package_spec check_and_get_package_spec(const std::string& package_spec_as_string, const triplet& default_target_triplet, const std::string& example_text) { @@ -42,11 +42,11 @@ namespace vcpkg {namespace Input } } - void check_triplets(std::vector<package_spec> triplets, const vcpkg_paths& paths) + void check_triplets(const std::vector<package_spec>& triplets, const vcpkg_paths& paths) { for (const package_spec& spec : triplets) { check_triplet(spec.target_triplet(), paths); } } -}} +} diff --git a/toolsrc/src/vcpkg_Strings.cpp b/toolsrc/src/vcpkg_Strings.cpp index 46a4b1855..cf7d3b0ee 100644 --- a/toolsrc/src/vcpkg_Strings.cpp +++ b/toolsrc/src/vcpkg_Strings.cpp @@ -7,7 +7,7 @@ #include <functional> #include <cctype> -namespace vcpkg {namespace Strings {namespace details +namespace vcpkg::Strings::details { // To disambiguate between two overloads static const auto isspace = [](const char c) @@ -40,9 +40,9 @@ namespace vcpkg {namespace Strings {namespace details return output; } -}}} +} -namespace vcpkg {namespace Strings +namespace vcpkg::Strings { std::wstring utf8_to_utf16(const std::string& s) { @@ -119,4 +119,4 @@ namespace vcpkg {namespace Strings return s == ""; }), strings->end()); } -}} +} diff --git a/toolsrc/src/vcpkg_System.cpp b/toolsrc/src/vcpkg_System.cpp index 43eae3412..405dfd1b8 100644 --- a/toolsrc/src/vcpkg_System.cpp +++ b/toolsrc/src/vcpkg_System.cpp @@ -3,7 +3,7 @@ #include <Windows.h> #include <regex> -namespace vcpkg {namespace System +namespace vcpkg::System { fs::path get_exe_path_of_current_process() { @@ -104,6 +104,6 @@ namespace vcpkg {namespace System double Stopwatch2::microseconds() const { return (reinterpret_cast<const LARGE_INTEGER*>(&end_time)->QuadPart - - reinterpret_cast<const LARGE_INTEGER*>(&start_time)->QuadPart) * 1000000.0 / reinterpret_cast<const LARGE_INTEGER*>(&freq)->QuadPart; + reinterpret_cast<const LARGE_INTEGER*>(&start_time)->QuadPart) * 1000000.0 / reinterpret_cast<const LARGE_INTEGER*>(&freq)->QuadPart; } -}} +} diff --git a/toolsrc/src/vcpkg_info.cpp b/toolsrc/src/vcpkg_info.cpp index 25c09d6da..69bc6a355 100644 --- a/toolsrc/src/vcpkg_info.cpp +++ b/toolsrc/src/vcpkg_info.cpp @@ -6,7 +6,7 @@ #define VCPKG_VERSION_AS_STRING MACRO_TO_STRING(VCPKG_VERSION)"" // Double quotes needed at the end to prevent blank token -namespace vcpkg { namespace Info +namespace vcpkg::Info { const std::string& version() { @@ -31,4 +31,4 @@ namespace vcpkg { namespace Info static const std::string s_email = R"(vcpkg@microsoft.com)"; return s_email; } -}} +} diff --git a/toolsrc/src/vcpkglib_helpers.cpp b/toolsrc/src/vcpkglib_helpers.cpp index d104bb19d..fdc287507 100644 --- a/toolsrc/src/vcpkglib_helpers.cpp +++ b/toolsrc/src/vcpkglib_helpers.cpp @@ -3,7 +3,7 @@ #include <unordered_map> #include <regex> -namespace vcpkg {namespace details +namespace vcpkg::details { std::string optional_field(const std::unordered_map<std::string, std::string>& fields, const std::string& fieldname) { @@ -53,4 +53,4 @@ namespace vcpkg {namespace details simple_desc.append("..."); return simple_desc; } -}} +} diff --git a/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj b/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj index 218a826ad..c0d108602 100644 --- a/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj +++ b/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj @@ -128,6 +128,7 @@ </ItemGroup> <ItemGroup> <ClInclude Include="..\include\expected.h" /> + <ClInclude Include="..\include\ImmutableSortedVector.h" /> <ClInclude Include="..\include\opt_bool.h" /> <ClInclude Include="..\include\Stopwatch.h" /> <ClInclude Include="..\include\vcpkg_Checks.h" /> diff --git a/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj.filters b/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj.filters index 4d40bfbe2..bba605c54 100644 --- a/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj.filters +++ b/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj.filters @@ -62,5 +62,8 @@ <ClInclude Include="..\include\Stopwatch.h"> <Filter>Header Files</Filter> </ClInclude> + <ClInclude Include="..\include\ImmutableSortedVector.h"> + <Filter>Header Files</Filter> + </ClInclude> </ItemGroup> </Project>
\ No newline at end of file |
