diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2017-04-03 16:13:46 -0700 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2017-04-04 16:44:43 -0700 |
| commit | b766a005b7a67d7adeadc16e765bda34d679f45d (patch) | |
| tree | 6be231a8b87203399bc22dc90478597d2e844edb | |
| parent | 5b0d9f3ee000446550c72dd2cbaa4c95ae976ac6 (diff) | |
| download | vcpkg-b766a005b7a67d7adeadc16e765bda34d679f45d.tar.gz vcpkg-b766a005b7a67d7adeadc16e765bda34d679f45d.zip | |
version_t -> VersionT
| -rw-r--r-- | toolsrc/include/Paragraphs.h | 4 | ||||
| -rw-r--r-- | toolsrc/include/Version.cpp | 20 | ||||
| -rw-r--r-- | toolsrc/include/Version.h | 28 | ||||
| -rw-r--r-- | toolsrc/include/VersionT.cpp | 20 | ||||
| -rw-r--r-- | toolsrc/include/VersionT.h | 28 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Commands.h | 2 | ||||
| -rw-r--r-- | toolsrc/include/version_t.cpp | 20 | ||||
| -rw-r--r-- | toolsrc/include/version_t.h | 28 | ||||
| -rw-r--r-- | toolsrc/src/Paragraphs.cpp | 4 | ||||
| -rw-r--r-- | toolsrc/src/commands_portsdiff.cpp | 20 | ||||
| -rw-r--r-- | toolsrc/src/commands_update.cpp | 2 | ||||
| -rw-r--r-- | toolsrc/vcpkglib/vcpkglib.vcxproj | 4 | ||||
| -rw-r--r-- | toolsrc/vcpkglib/vcpkglib.vcxproj.filters | 12 |
13 files changed, 120 insertions, 72 deletions
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<SourceParagraph> load_all_ports(const fs::path& ports_dir); - std::map<std::string, version_t> extract_port_names_and_versions(const std::vector<SourceParagraph>& source_paragraphs); + std::map<std::string, VersionT> extract_port_names_and_versions(const std::vector<SourceParagraph>& 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 <string> + +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 <string> + +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 <array> -#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 <string> - -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<std::string, version_t> extract_port_names_and_versions(const std::vector<SourceParagraph>& source_paragraphs) + std::map<std::string, VersionT> extract_port_names_and_versions(const std::vector<SourceParagraph>& source_paragraphs) { - std::map<std::string, version_t> names_and_versions; + std::map<std::string, VersionT> 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<updated_port> find_updated_ports(const std::vector<std::string>& ports, - const std::map<std::string, version_t>& previous_names_and_versions, - const std::map<std::string, version_t>& current_names_and_versions) + const std::map<std::string, VersionT>& previous_names_and_versions, + const std::map<std::string, VersionT>& current_names_and_versions) { std::vector<updated_port> 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<std::string>& ports_to_print, const std::map<std::string, version_t>& names_and_versions) + static void do_print_name_and_version(const std::vector<std::string>& ports_to_print, const std::map<std::string, VersionT>& 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<std::string, version_t> read_ports_from_commit(const vcpkg_paths& paths, const std::wstring& git_commit_id) + static std::map<std::string, VersionT> 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<SourceParagraph> source_paragraphs = Paragraphs::load_all_ports(temp_checkout_path / ports_dir_name_as_string); - const std::map<std::string, version_t> names_and_versions = Paragraphs::extract_port_names_and_versions(source_paragraphs); + const std::map<std::string, VersionT> 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<std::string, version_t> current_names_and_versions = read_ports_from_commit(paths, git_commit_id_for_current_snapshot); - const std::map<std::string, version_t> previous_names_and_versions = read_ports_from_commit(paths, git_commit_id_for_previous_snapshot); + const std::map<std::string, VersionT> current_names_and_versions = read_ports_from_commit(paths, git_commit_id_for_current_snapshot); + const std::map<std::string, VersionT> 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<std::string> 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<OutdatedPackage> find_outdated_packages(const vcpkg_paths& paths, const StatusParagraphs& status_db) { const std::vector<SourceParagraph> source_paragraphs = Paragraphs::load_all_ports(paths.ports); - const std::map<std::string, version_t> src_names_to_versions = Paragraphs::extract_port_names_and_versions(source_paragraphs); + const std::map<std::string, VersionT> src_names_to_versions = Paragraphs::extract_port_names_and_versions(source_paragraphs); const std::vector<StatusParagraph*> installed_packages = get_installed_ports(status_db); std::vector<OutdatedPackage> 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 @@ <ClInclude Include="..\include\vcpkg_Strings.h" /> <ClInclude Include="..\include\vcpkg_System.h" /> <ClInclude Include="..\include\vcpkg_Util.h" /> - <ClInclude Include="..\include\version_t.h" /> + <ClInclude Include="..\include\VersionT.h" /> </ItemGroup> <ItemGroup> - <ClCompile Include="..\include\version_t.cpp" /> + <ClCompile Include="..\include\VersionT.cpp" /> <ClCompile Include="..\src\BinaryParagraph.cpp" /> <ClCompile Include="..\src\commands_ci.cpp" /> <ClCompile Include="..\src\commands_env.cpp" /> 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 @@ <ClCompile Include="..\src\LineInfo.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\include\version_t.cpp"> - <Filter>Source Files</Filter> - </ClCompile> <ClCompile Include="..\src\commands_env.cpp"> <Filter>Source Files</Filter> </ClCompile> @@ -180,6 +177,9 @@ <ClCompile Include="..\src\VcpkgCmdArguments.cpp"> <Filter>Source Files</Filter> </ClCompile> + <ClCompile Include="..\include\VersionT.cpp"> + <Filter>Source Files</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\include\SourceParagraph.h"> @@ -287,9 +287,6 @@ <ClInclude Include="..\include\vcpkg_expected.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\include\version_t.h"> - <Filter>Header Files</Filter> - </ClInclude> <ClInclude Include="..\include\vcpkg_Util.h"> <Filter>Header Files</Filter> </ClInclude> @@ -314,5 +311,8 @@ <ClInclude Include="..\include\VcpkgCmdArguments.h"> <Filter>Header Files</Filter> </ClInclude> + <ClInclude Include="..\include\VersionT.h"> + <Filter>Header Files</Filter> + </ClInclude> </ItemGroup> </Project>
\ No newline at end of file |
