From b766a005b7a67d7adeadc16e765bda34d679f45d Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 3 Apr 2017 16:13:46 -0700 Subject: version_t -> VersionT --- toolsrc/include/Paragraphs.h | 4 ++-- toolsrc/include/Version.cpp | 20 ++++++++++++++++++++ toolsrc/include/Version.h | 28 ++++++++++++++++++++++++++++ toolsrc/include/VersionT.cpp | 20 ++++++++++++++++++++ toolsrc/include/VersionT.h | 28 ++++++++++++++++++++++++++++ toolsrc/include/vcpkg_Commands.h | 2 +- toolsrc/include/version_t.cpp | 20 -------------------- toolsrc/include/version_t.h | 28 ---------------------------- toolsrc/src/Paragraphs.cpp | 4 ++-- toolsrc/src/commands_portsdiff.cpp | 20 ++++++++++---------- toolsrc/src/commands_update.cpp | 2 +- toolsrc/vcpkglib/vcpkglib.vcxproj | 4 ++-- toolsrc/vcpkglib/vcpkglib.vcxproj.filters | 12 ++++++------ 13 files changed, 120 insertions(+), 72 deletions(-) create mode 100644 toolsrc/include/Version.cpp create mode 100644 toolsrc/include/Version.h create mode 100644 toolsrc/include/VersionT.cpp create mode 100644 toolsrc/include/VersionT.h delete mode 100644 toolsrc/include/version_t.cpp delete mode 100644 toolsrc/include/version_t.h diff --git a/toolsrc/include/Paragraphs.h b/toolsrc/include/Paragraphs.h index 101b6dde6..9135e0c7b 100644 --- a/toolsrc/include/Paragraphs.h +++ b/toolsrc/include/Paragraphs.h @@ -5,7 +5,7 @@ #include "vcpkg_expected.h" #include "BinaryParagraph.h" #include "vcpkg_paths.h" -#include "version_t.h" +#include "VersionT.h" namespace vcpkg::Paragraphs { @@ -22,5 +22,5 @@ namespace vcpkg::Paragraphs std::vector load_all_ports(const fs::path& ports_dir); - std::map extract_port_names_and_versions(const std::vector& source_paragraphs); + std::map extract_port_names_and_versions(const std::vector& source_paragraphs); } diff --git a/toolsrc/include/Version.cpp b/toolsrc/include/Version.cpp new file mode 100644 index 000000000..6b9f3da54 --- /dev/null +++ b/toolsrc/include/Version.cpp @@ -0,0 +1,20 @@ +#include "pch.h" +#include "Version.h" +#include "vcpkg_Strings.h" + +namespace vcpkg +{ + Version::Version() : value("0.0.0") {} + Version::Version(const std::string& value) : value(value) {} + bool operator==(const Version& left, const Version& right) { return left.value == right.value; } + bool operator!=(const Version& left, const Version& right) { return left.value != right.value; } + std::string to_printf_arg(const Version& version) { return version.value; } + + version_diff_t::version_diff_t() : left(), right() {} + version_diff_t::version_diff_t(const Version& left, const Version& right) : left(left), right(right) {} + + std::string version_diff_t::toString() const + { + return Strings::format("%s -> %s", left.value, right.value); + } +} diff --git a/toolsrc/include/Version.h b/toolsrc/include/Version.h new file mode 100644 index 000000000..9d81ce829 --- /dev/null +++ b/toolsrc/include/Version.h @@ -0,0 +1,28 @@ +#pragma once +#include + +namespace vcpkg +{ + struct Version + { + Version(); + Version(const std::string& value); + + std::string value; + }; + + bool operator ==(const Version& left, const Version& right); + bool operator !=(const Version& left, const Version& right); + std::string to_printf_arg(const Version& version); + + struct version_diff_t + { + Version left; + Version right; + + version_diff_t(); + version_diff_t(const Version& left, const Version& right); + + std::string toString() const; + }; +} diff --git a/toolsrc/include/VersionT.cpp b/toolsrc/include/VersionT.cpp new file mode 100644 index 000000000..617fa23c7 --- /dev/null +++ b/toolsrc/include/VersionT.cpp @@ -0,0 +1,20 @@ +#include "pch.h" +#include "VersionT.h" +#include "vcpkg_Strings.h" + +namespace vcpkg +{ + VersionT::VersionT() : value("0.0.0") {} + VersionT::VersionT(const std::string& value) : value(value) {} + bool operator==(const VersionT& left, const VersionT& right) { return left.value == right.value; } + bool operator!=(const VersionT& left, const VersionT& right) { return left.value != right.value; } + std::string to_printf_arg(const VersionT& version) { return version.value; } + + version_diff_t::version_diff_t() : left(), right() {} + version_diff_t::version_diff_t(const VersionT& left, const VersionT& right) : left(left), right(right) {} + + std::string version_diff_t::toString() const + { + return Strings::format("%s -> %s", left.value, right.value); + } +} diff --git a/toolsrc/include/VersionT.h b/toolsrc/include/VersionT.h new file mode 100644 index 000000000..f02479f46 --- /dev/null +++ b/toolsrc/include/VersionT.h @@ -0,0 +1,28 @@ +#pragma once +#include + +namespace vcpkg +{ + struct VersionT + { + VersionT(); + VersionT(const std::string& value); + + std::string value; + }; + + bool operator ==(const VersionT& left, const VersionT& right); + bool operator !=(const VersionT& left, const VersionT& right); + std::string to_printf_arg(const VersionT& version); + + struct version_diff_t + { + VersionT left; + VersionT right; + + version_diff_t(); + version_diff_t(const VersionT& left, const VersionT& right); + + std::string toString() const; + }; +} diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 2c2d3d4cb..6bdc7d10e 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -4,7 +4,7 @@ #include "vcpkg_paths.h" #include "StatusParagraphs.h" #include -#include "version_t.h" +#include "VersionT.h" namespace vcpkg::Commands { diff --git a/toolsrc/include/version_t.cpp b/toolsrc/include/version_t.cpp deleted file mode 100644 index feb110542..000000000 --- a/toolsrc/include/version_t.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "pch.h" -#include "version_t.h" -#include "vcpkg_Strings.h" - -namespace vcpkg -{ - version_t::version_t() : value("0.0.0") {} - version_t::version_t(const std::string& value) : value(value) {} - bool operator==(const version_t& left, const version_t& right) { return left.value == right.value; } - bool operator!=(const version_t& left, const version_t& right) { return left.value != right.value; } - std::string to_printf_arg(const version_t& version) { return version.value; } - - version_diff_t::version_diff_t() : left(), right() {} - version_diff_t::version_diff_t(const version_t& left, const version_t& right) : left(left), right(right) {} - - std::string version_diff_t::toString() const - { - return Strings::format("%s -> %s", left.value, right.value); - } -} diff --git a/toolsrc/include/version_t.h b/toolsrc/include/version_t.h deleted file mode 100644 index 9a4e11a39..000000000 --- a/toolsrc/include/version_t.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once -#include - -namespace vcpkg -{ - struct version_t - { - version_t(); - version_t(const std::string& value); - - std::string value; - }; - - bool operator ==(const version_t& left, const version_t& right); - bool operator !=(const version_t& left, const version_t& right); - std::string to_printf_arg(const version_t& version); - - struct version_diff_t - { - version_t left; - version_t right; - - version_diff_t(); - version_diff_t(const version_t& left, const version_t& right); - - std::string toString() const; - }; -} diff --git a/toolsrc/src/Paragraphs.cpp b/toolsrc/src/Paragraphs.cpp index 0d91e95a9..61da7a866 100644 --- a/toolsrc/src/Paragraphs.cpp +++ b/toolsrc/src/Paragraphs.cpp @@ -250,9 +250,9 @@ namespace vcpkg::Paragraphs return output; } - std::map extract_port_names_and_versions(const std::vector& source_paragraphs) + std::map extract_port_names_and_versions(const std::vector& source_paragraphs) { - std::map names_and_versions; + std::map names_and_versions; for (const SourceParagraph& port : source_paragraphs) { names_and_versions.emplace(port.name, port.version); diff --git a/toolsrc/src/commands_portsdiff.cpp b/toolsrc/src/commands_portsdiff.cpp index 8f1b59170..c1110b522 100644 --- a/toolsrc/src/commands_portsdiff.cpp +++ b/toolsrc/src/commands_portsdiff.cpp @@ -39,14 +39,14 @@ namespace vcpkg::Commands::PortsDiff }; static std::vector find_updated_ports(const std::vector& ports, - const std::map& previous_names_and_versions, - const std::map& current_names_and_versions) + const std::map& previous_names_and_versions, + const std::map& current_names_and_versions) { std::vector output; for (const std::string& name : ports) { - const version_t& previous_version = previous_names_and_versions.at(name); - const version_t& current_version = current_names_and_versions.at(name); + const VersionT& previous_version = previous_names_and_versions.at(name); + const VersionT& current_version = current_names_and_versions.at(name); if (previous_version == current_version) { continue; @@ -58,16 +58,16 @@ namespace vcpkg::Commands::PortsDiff return output; } - static void do_print_name_and_version(const std::vector& ports_to_print, const std::map& names_and_versions) + static void do_print_name_and_version(const std::vector& ports_to_print, const std::map& names_and_versions) { for (const std::string& name : ports_to_print) { - const version_t& version = names_and_versions.at(name); + const VersionT& version = names_and_versions.at(name); System::println("%-20s %-16s", name, version); } } - static std::map read_ports_from_commit(const vcpkg_paths& paths, const std::wstring& git_commit_id) + static std::map read_ports_from_commit(const vcpkg_paths& paths, const std::wstring& git_commit_id) { const fs::path& git_exe = paths.get_git_exe(); const fs::path dot_git_dir = paths.root / ".git"; @@ -86,7 +86,7 @@ namespace vcpkg::Commands::PortsDiff git_exe.native()); System::cmd_execute_clean(cmd); const std::vector source_paragraphs = Paragraphs::load_all_ports(temp_checkout_path / ports_dir_name_as_string); - const std::map names_and_versions = Paragraphs::extract_port_names_and_versions(source_paragraphs); + const std::map names_and_versions = Paragraphs::extract_port_names_and_versions(source_paragraphs); fs::remove_all(temp_checkout_path); return names_and_versions; } @@ -115,8 +115,8 @@ namespace vcpkg::Commands::PortsDiff check_commit_exists(git_exe, git_commit_id_for_current_snapshot); check_commit_exists(git_exe, git_commit_id_for_previous_snapshot); - const std::map current_names_and_versions = read_ports_from_commit(paths, git_commit_id_for_current_snapshot); - const std::map previous_names_and_versions = read_ports_from_commit(paths, git_commit_id_for_previous_snapshot); + const std::map current_names_and_versions = read_ports_from_commit(paths, git_commit_id_for_current_snapshot); + const std::map previous_names_and_versions = read_ports_from_commit(paths, git_commit_id_for_previous_snapshot); // Already sorted, so set_difference can work on std::vector too std::vector current_ports = Maps::extract_keys(current_names_and_versions); diff --git a/toolsrc/src/commands_update.cpp b/toolsrc/src/commands_update.cpp index a4cb63439..845813488 100644 --- a/toolsrc/src/commands_update.cpp +++ b/toolsrc/src/commands_update.cpp @@ -15,7 +15,7 @@ namespace vcpkg::Commands::Update std::vector find_outdated_packages(const vcpkg_paths& paths, const StatusParagraphs& status_db) { const std::vector source_paragraphs = Paragraphs::load_all_ports(paths.ports); - const std::map src_names_to_versions = Paragraphs::extract_port_names_and_versions(source_paragraphs); + const std::map src_names_to_versions = Paragraphs::extract_port_names_and_versions(source_paragraphs); const std::vector installed_packages = get_installed_ports(status_db); std::vector output; diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj index 6d6417af4..e136065ef 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj @@ -179,10 +179,10 @@ - + - + diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters index 8a046c80f..0555b78b0 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters @@ -159,9 +159,6 @@ Source Files - - Source Files - Source Files @@ -180,6 +177,9 @@ Source Files + + Source Files + @@ -287,9 +287,6 @@ Header Files - - Header Files - Header Files @@ -314,5 +311,8 @@ Header Files + + Header Files + \ No newline at end of file -- cgit v1.2.3