diff options
Diffstat (limited to 'toolsrc/include')
| -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 |
8 files changed, 99 insertions, 51 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; - }; -} |
