From 1310e9e052de50a8d53bc9b88696f8b6c61bece6 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Mon, 12 Dec 2016 14:03:13 -0800 Subject: Add SQM User Id to metrics --- toolsrc/include/metrics.h | 1 + 1 file changed, 1 insertion(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/metrics.h b/toolsrc/include/metrics.h index 52662cd97..a0f4fc61d 100644 --- a/toolsrc/include/metrics.h +++ b/toolsrc/include/metrics.h @@ -13,6 +13,7 @@ namespace vcpkg void TrackProperty(const std::string& name, const std::string& value); void TrackProperty(const std::string& name, const std::wstring& value); bool GetCompiledMetricsEnabled(); + std::wstring GetSQMUser(); void Upload(const std::string& payload); void Flush(); -- cgit v1.2.3 From d02fe9bdae3553660896d14ef24c2b6dc82bb6db Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 12 Dec 2016 14:58:38 -0800 Subject: Add System::println(std::string) overloads --- toolsrc/include/vcpkg_System.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h index e059bde0a..ca81235ed 100644 --- a/toolsrc/include/vcpkg_System.h +++ b/toolsrc/include/vcpkg_System.h @@ -39,6 +39,26 @@ namespace vcpkg {namespace System void print(color c, const char* message); void println(color c, const char* message); + inline void print(const std::string& message) + { + return print(message.c_str()); + } + + inline void println(const std::string& message) + { + return println(message.c_str()); + } + + inline void print(color c, const std::string& message) + { + return print(c, message.c_str()); + } + + inline void println(color c, const std::string& message) + { + return println(c, message.c_str()); + } + template void print(const char* messageTemplate, const Args&... messageArgs) { -- cgit v1.2.3 From b629cd904440c640b7e5b4c3fdf17df5aac90bad Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 12 Dec 2016 15:03:36 -0800 Subject: [vcpkg_cmd_arguments] Use std::string instead of char* --- toolsrc/include/vcpkg_cmd_arguments.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_cmd_arguments.h b/toolsrc/include/vcpkg_cmd_arguments.h index 95feb4814..2194e6d2c 100644 --- a/toolsrc/include/vcpkg_cmd_arguments.h +++ b/toolsrc/include/vcpkg_cmd_arguments.h @@ -24,11 +24,11 @@ namespace vcpkg std::unordered_set check_and_get_optional_command_arguments(const std::vector& valid_options) const; void check_max_arg_count(const size_t expected_arg_count) const; - void check_max_arg_count(const size_t expected_arg_count, const char* example_text) const; + void check_max_arg_count(const size_t expected_arg_count, const std::string& example_text) const; void check_min_arg_count(const size_t expected_arg_count) const; - void check_min_arg_count(const size_t expected_arg_count, const char* example_text) const; + void check_min_arg_count(const size_t expected_arg_count, const std::string& example_text) const; void check_exact_arg_count(const size_t expected_arg_count) const; - void check_exact_arg_count(const size_t expected_arg_count, const char* example_text) const; + void check_exact_arg_count(const size_t expected_arg_count, const std::string& example_text) const; private: std::unordered_set optional_command_arguments; -- cgit v1.2.3 From 852acbc2638c21d9639258417b8cd9fceed722c2 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 12 Dec 2016 15:05:49 -0800 Subject: [vcpkg_Input] Use std::string instead of char* --- toolsrc/include/vcpkg_Input.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Input.h b/toolsrc/include/vcpkg_Input.h index bbf3adfbf..5ce90e3b9 100644 --- a/toolsrc/include/vcpkg_Input.h +++ b/toolsrc/include/vcpkg_Input.h @@ -5,9 +5,9 @@ namespace vcpkg {namespace Input { - package_spec check_and_get_package_spec(const std::string& package_spec_as_string, const triplet& default_target_triplet, const char* example_text); + package_spec check_and_get_package_spec(const std::string& package_spec_as_string, const triplet& default_target_triplet, const std::string& example_text); - std::vector check_and_get_package_specs(const std::vector& package_specs_as_strings, const triplet& default_target_triplet, const char* example_text); + std::vector check_and_get_package_specs(const std::vector& package_specs_as_strings, const triplet& default_target_triplet, const std::string& example_text); void check_triplet(const triplet& t, const vcpkg_paths& paths); -- cgit v1.2.3 From c77be8f221dbbb7b38c74ce382be9b4dbb4d296b Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 12 Dec 2016 15:08:26 -0800 Subject: [vcpkg_System] Add missing const keywords --- toolsrc/include/vcpkg_System.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h index ca81235ed..1101c9b27 100644 --- a/toolsrc/include/vcpkg_System.h +++ b/toolsrc/include/vcpkg_System.h @@ -36,8 +36,8 @@ namespace vcpkg {namespace System void print(const char* message); void println(const char* message); - void print(color c, const char* message); - void println(color c, const char* message); + void print(const color c, const char* message); + void println(const color c, const char* message); inline void print(const std::string& message) { @@ -49,12 +49,12 @@ namespace vcpkg {namespace System return println(message.c_str()); } - inline void print(color c, const std::string& message) + inline void print(const color c, const std::string& message) { return print(c, message.c_str()); } - inline void println(color c, const std::string& message) + inline void println(const color c, const std::string& message) { return println(c, message.c_str()); } @@ -66,7 +66,7 @@ namespace vcpkg {namespace System } template - void print(color c, const char* messageTemplate, const Args&... messageArgs) + void print(const color c, const char* messageTemplate, const Args&... messageArgs) { return print(c, Strings::format(messageTemplate, messageArgs...).c_str()); } @@ -78,7 +78,7 @@ namespace vcpkg {namespace System } template - void println(color c, const char* messageTemplate, const Args&... messageArgs) + void println(const color c, const char* messageTemplate, const Args&... messageArgs) { return println(c, Strings::format(messageTemplate, messageArgs...).c_str()); } -- cgit v1.2.3 From e523668cce29745d8024dd5d56ee1d705da24a49 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 12 Dec 2016 15:13:24 -0800 Subject: Change signature to std::string& (from char*) --- toolsrc/include/vcpkg_Commands.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 8272929a7..fd427fd40 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -8,8 +8,8 @@ namespace vcpkg extern const char*const INTEGRATE_COMMAND_HELPSTRING; void print_usage(); - void print_example(const char* command_and_arguments); - std::string create_example_string(const char* command_and_arguments); + void print_example(const std::string& command_and_arguments); + std::string create_example_string(const std::string& command_and_arguments); void update_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); void build_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); -- cgit v1.2.3 From 8f397bb8d1bd05a2e1f6d5de808322364100ae5d Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 15 Dec 2016 17:09:14 -0800 Subject: Add Strings::trim() function --- toolsrc/include/vcpkg_Strings.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Strings.h b/toolsrc/include/vcpkg_Strings.h index 859da5658..92c24298c 100644 --- a/toolsrc/include/vcpkg_Strings.h +++ b/toolsrc/include/vcpkg_Strings.h @@ -69,4 +69,8 @@ namespace vcpkg {namespace Strings std::string ascii_to_lowercase(const std::string& input); std::string join(const std::vector& v, const std::string& delimiter); + + void trim(std::string* s); + + std::string trimmed(const std::string& s); }} -- cgit v1.2.3 From e4548a8cf46b20b8e89ab75ee9201e3b244484ba Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 15 Dec 2016 18:19:22 -0800 Subject: Add Files::read_all_lines() and Files::write_all_lines() --- toolsrc/include/vcpkg_Files.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Files.h b/toolsrc/include/vcpkg_Files.h index 8b320303d..5e788f7be 100644 --- a/toolsrc/include/vcpkg_Files.h +++ b/toolsrc/include/vcpkg_Files.h @@ -14,6 +14,10 @@ namespace vcpkg {namespace Files expected get_contents(const fs::path& file_path) noexcept; + expected> read_all_lines(const fs::path& file_path); + + void write_all_lines(const fs::path& file_path, const std::vector& lines); + fs::path find_file_recursively_up(const fs::path& starting_dir, const std::string& filename); template -- cgit v1.2.3 From a5c3fddfe7bc4f765a0efdd9b109709f2fb4ae9c Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 16 Dec 2016 16:02:19 -0800 Subject: Add Strings::trim_all_and_remove_whitespace_strings() --- toolsrc/include/vcpkg_Strings.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Strings.h b/toolsrc/include/vcpkg_Strings.h index 92c24298c..a117a1a81 100644 --- a/toolsrc/include/vcpkg_Strings.h +++ b/toolsrc/include/vcpkg_Strings.h @@ -73,4 +73,6 @@ namespace vcpkg {namespace Strings void trim(std::string* s); std::string trimmed(const std::string& s); + + void trim_all_and_remove_whitespace_strings(std::vector* strings); }} -- cgit v1.2.3 From b666e90c32e58a673331b303e64e299cc1168aa2 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 16 Dec 2016 19:38:02 -0800 Subject: Pass by ref --- toolsrc/include/vcpkg_Files.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Files.h b/toolsrc/include/vcpkg_Files.h index 5e788f7be..b0a9747bf 100644 --- a/toolsrc/include/vcpkg_Files.h +++ b/toolsrc/include/vcpkg_Files.h @@ -10,7 +10,7 @@ namespace vcpkg {namespace Files void check_is_directory(const fs::path& dirpath); - bool has_invalid_chars_for_filesystem(const std::string s); + bool has_invalid_chars_for_filesystem(const std::string& s); expected get_contents(const fs::path& file_path) noexcept; -- cgit v1.2.3 From aad0cc4c042aad87b2b52eded0e465ed01e799c1 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 16 Dec 2016 19:40:58 -0800 Subject: Files::get_contents() -> Files::read_contents() --- toolsrc/include/vcpkg_Files.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg_Files.h b/toolsrc/include/vcpkg_Files.h index b0a9747bf..6c9d0d365 100644 --- a/toolsrc/include/vcpkg_Files.h +++ b/toolsrc/include/vcpkg_Files.h @@ -12,7 +12,7 @@ namespace vcpkg {namespace Files bool has_invalid_chars_for_filesystem(const std::string& s); - expected get_contents(const fs::path& file_path) noexcept; + expected read_contents(const fs::path& file_path) noexcept; expected> read_all_lines(const fs::path& file_path); -- cgit v1.2.3 From 73bf8306b29d68853dc3c97d5dd415bd5e857cf5 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 16 Dec 2016 20:11:50 -0800 Subject: Pass by const ref --- toolsrc/include/coff_file_reader.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/coff_file_reader.h b/toolsrc/include/coff_file_reader.h index 1a9a071ef..edf6910a5 100644 --- a/toolsrc/include/coff_file_reader.h +++ b/toolsrc/include/coff_file_reader.h @@ -15,7 +15,7 @@ namespace vcpkg {namespace COFFFileReader std::vector machine_types; }; - dll_info read_dll(const fs::path path); + dll_info read_dll(const fs::path& path); - lib_info read_lib(const fs::path path); + lib_info read_lib(const fs::path& path); }} -- cgit v1.2.3 From 835693ce97f271c0213f65c1c782e8df84cfb409 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 16 Dec 2016 20:17:24 -0800 Subject: Don't return by const value --- toolsrc/include/BuildInfo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/BuildInfo.h b/toolsrc/include/BuildInfo.h index 9f872385e..49811d521 100644 --- a/toolsrc/include/BuildInfo.h +++ b/toolsrc/include/BuildInfo.h @@ -104,7 +104,7 @@ namespace vcpkg { namespace PostBuildLint OutdatedDynamicCrt() = delete; - const std::regex crt_regex() const; + std::regex crt_regex() const; const std::string& toString() const; private: -- cgit v1.2.3