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 /toolsrc/include | |
| parent | 44c86f56db351da15e5a2b2fcca62656ab8cccbf (diff) | |
| parent | ff10939203b7694f21d8e8e0464f092dff1b4eb0 (diff) | |
| download | vcpkg-04f8da985c9acdd090055ad06bcf75eb20af1987.tar.gz vcpkg-04f8da985c9acdd090055ad06bcf75eb20af1987.zip | |
Merge branch 'master' of https://github.com/Microsoft/vcpkg
Diffstat (limited to 'toolsrc/include')
| -rw-r--r-- | toolsrc/include/BuildInfo.h | 4 | ||||
| -rw-r--r-- | toolsrc/include/ImmutableSortedVector.h | 48 | ||||
| -rw-r--r-- | toolsrc/include/Paragraphs.h | 4 | ||||
| -rw-r--r-- | toolsrc/include/coff_file_reader.h | 4 | ||||
| -rw-r--r-- | toolsrc/include/post_build_lint.h | 4 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg.h | 3 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Checks.h | 4 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Dependencies.h | 4 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Environment.h | 4 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Files.h | 4 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Graphs.h | 4 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Input.h | 6 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Maps.h | 4 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Sets.h | 4 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Strings.h | 8 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_System.h | 4 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_info.h | 4 | ||||
| -rw-r--r-- | toolsrc/include/vcpkglib_helpers.h | 4 |
18 files changed, 85 insertions, 36 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); -}} +} |
