diff options
| author | Barath Kannan <barathsotd@gmail.com> | 2017-10-17 20:25:12 +1100 |
|---|---|---|
| committer | Barath Kannan <barathsotd@gmail.com> | 2017-10-17 20:25:12 +1100 |
| commit | 48128e5b4dc964a306737e829affe349d8c6956c (patch) | |
| tree | 414b608b8ad3037d0324bb77c83881c4306ef521 /toolsrc/include | |
| parent | ddc421acbc8bc9dd1d448190ac173b9d11e942dd (diff) | |
| parent | 7ed8d4f75e903fdad4c02b4e784f2f4bcb30a3b0 (diff) | |
| download | vcpkg-48128e5b4dc964a306737e829affe349d8c6956c.tar.gz vcpkg-48128e5b4dc964a306737e829affe349d8c6956c.zip | |
Merge branch 'master' of https://github.com/Microsoft/vcpkg into qt5_modular
Diffstat (limited to 'toolsrc/include')
| -rw-r--r-- | toolsrc/include/CStringView.h | 96 | ||||
| -rw-r--r-- | toolsrc/include/Span.h | 52 | ||||
| -rw-r--r-- | toolsrc/include/filesystem_fs.h | 16 | ||||
| -rw-r--r-- | toolsrc/include/pch.h | 26 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/checks.h (renamed from toolsrc/include/vcpkg_Checks.h) | 5 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/chrono.h (renamed from toolsrc/include/vcpkg_Chrono.h) | 2 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/cofffilereader.h (renamed from toolsrc/include/coff_file_reader.h) | 6 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/cstringview.h | 69 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/enums.h (renamed from toolsrc/include/vcpkg_Enums.h) | 4 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/expected.h (renamed from toolsrc/include/vcpkg_expected.h) | 9 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/files.h (renamed from toolsrc/include/vcpkg_Files.h) | 32 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/graphs.h (renamed from toolsrc/include/vcpkg_Graphs.h) | 8 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/lazy.h (renamed from toolsrc/include/lazy.h) | 0 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/lineinfo.h (renamed from toolsrc/include/LineInfo.h) | 0 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/machinetype.h (renamed from toolsrc/include/MachineType.h) | 1 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/optional.h (renamed from toolsrc/include/vcpkg_optional.h) | 7 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/sortedvector.h (renamed from toolsrc/include/SortedVector.h) | 0 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/span.h | 60 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/strings.h (renamed from toolsrc/include/vcpkg_Strings.h) | 51 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/system.h (renamed from toolsrc/include/vcpkg_System.h) | 21 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/util.h (renamed from toolsrc/include/vcpkg_Util.h) | 44 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/binaryparagraph.h (renamed from toolsrc/include/BinaryParagraph.h) | 5 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/build.h (renamed from toolsrc/include/vcpkg_Build.h) | 27 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/commands.h | 135 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/dependencies.h (renamed from toolsrc/include/vcpkg_Dependencies.h) | 19 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/export.h | 10 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/export.ifw.h (renamed from toolsrc/include/vcpkg_Commands_Export_IFW.h) | 9 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/globalstate.h (renamed from toolsrc/include/vcpkg_GlobalState.h) | 8 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/help.h | 19 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/input.h (renamed from toolsrc/include/vcpkg_Input.h) | 3 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/install.h | 71 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/metrics.h (renamed from toolsrc/include/metrics.h) | 7 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/packagespec.h (renamed from toolsrc/include/PackageSpec.h) | 39 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/packagespecparseresult.h (renamed from toolsrc/include/PackageSpecParseResult.h) | 5 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/paragraphparseresult.h (renamed from toolsrc/include/ParagraphParseResult.h) | 12 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/paragraphs.h (renamed from toolsrc/include/Paragraphs.h) | 14 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/parse.h (renamed from toolsrc/include/vcpkg_Parse.h) | 6 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/postbuildlint.buildtype.h (renamed from toolsrc/include/PostBuildLint_BuildType.h) | 6 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/postbuildlint.h (renamed from toolsrc/include/PostBuildLint.h) | 7 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/remove.h | 26 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/sourceparagraph.h (renamed from toolsrc/include/SourceParagraph.h) | 11 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/statusparagraph.h (renamed from toolsrc/include/StatusParagraph.h) | 3 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/statusparagraphs.h (renamed from toolsrc/include/StatusParagraphs.h) | 3 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/triplet.h (renamed from toolsrc/include/triplet.h) | 11 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/update.h | 21 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/vcpkgcmdarguments.h (renamed from toolsrc/include/VcpkgCmdArguments.h) | 24 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/vcpkglib.h (renamed from toolsrc/include/vcpkglib.h) | 21 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/vcpkgpaths.h (renamed from toolsrc/include/VcpkgPaths.h) | 25 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/versiont.h (renamed from toolsrc/include/VersionT.h) | 0 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Commands.h | 258 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Commands_Export.h | 8 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Maps.h | 30 |
52 files changed, 704 insertions, 648 deletions
diff --git a/toolsrc/include/CStringView.h b/toolsrc/include/CStringView.h deleted file mode 100644 index c1810b4f1..000000000 --- a/toolsrc/include/CStringView.h +++ /dev/null @@ -1,96 +0,0 @@ -#pragma once -#include <string> - -namespace vcpkg -{ - template<class CharType> - struct BasicCStringView - { - constexpr BasicCStringView() : cstr(nullptr) {} - constexpr BasicCStringView(const CharType* cstr) : cstr(cstr) {} - constexpr BasicCStringView(const BasicCStringView&) = default; - BasicCStringView(const std::basic_string<CharType>& str) : cstr(str.c_str()) {} - - constexpr const CharType* c_str() const { return cstr; } - - private: - const CharType* cstr; - }; - - namespace details - { - inline bool vcpkg_strcmp(const char* l, const char* r) { return strcmp(l, r) == 0; } - inline bool vcpkg_strcmp(const wchar_t* l, const wchar_t* r) { return wcscmp(l, r) == 0; } - } - - template<class CharType> - bool operator==(const BasicCStringView<CharType>& l, const BasicCStringView<CharType>& r) - { - return details::vcpkg_strcmp(l.c_str(), r.c_str()); - } - - template<class CharType> - bool operator==(const CharType* l, const BasicCStringView<CharType>& r) - { - return details::vcpkg_strcmp(l, r.c_str()); - } - - template<class CharType> - bool operator==(const BasicCStringView<CharType>& r, const CharType* l) - { - return details::vcpkg_strcmp(l, r.c_str()); - } - - template<class CharType> - bool operator==(const std::basic_string<CharType>& l, const BasicCStringView<CharType>& r) - { - return l == r.c_str(); - } - - template<class CharType> - bool operator==(const BasicCStringView<CharType>& r, const std::basic_string<CharType>& l) - { - return l == r.c_str(); - } - - // notequals - template<class CharType> - bool operator!=(const BasicCStringView<CharType>& l, const BasicCStringView<CharType>& r) - { - return !details::vcpkg_strcmp(l.c_str(), r.c_str()); - } - - template<class CharType> - bool operator!=(const CharType* l, const BasicCStringView<CharType>& r) - { - return !details::vcpkg_strcmp(l, r.c_str()); - } - - template<class CharType> - bool operator!=(const BasicCStringView<CharType>& r, const CharType* l) - { - return !details::vcpkg_strcmp(l, r.c_str()); - } - - template<class CharType> - bool operator!=(const BasicCStringView<CharType>& r, const std::basic_string<CharType>& l) - { - return l != r.c_str(); - } - - template<class CharType> - bool operator!=(const std::basic_string<CharType>& l, const BasicCStringView<CharType>& r) - { - return l != r.c_str(); - } - - using CStringView = BasicCStringView<char>; - using CWStringView = BasicCStringView<wchar_t>; - - inline const char* to_printf_arg(const CStringView string_view) { return string_view.c_str(); } - - inline const wchar_t* to_wprintf_arg(const CWStringView string_view) { return string_view.c_str(); } - - static_assert(sizeof(CStringView) == sizeof(void*), "CStringView must be a simple wrapper around char*"); - static_assert(sizeof(CWStringView) == sizeof(void*), "CWStringView must be a simple wrapper around wchar_t*"); -} diff --git a/toolsrc/include/Span.h b/toolsrc/include/Span.h deleted file mode 100644 index a43e8f992..000000000 --- a/toolsrc/include/Span.h +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once
-
-#include <array>
-#include <cstddef>
-#include <initializer_list>
-#include <vector>
-
-template<class T>
-struct Span
-{
-public:
- using element_type = T;
- using pointer = T*;
- using reference = T&;
- using iterator = T*;
-
- constexpr Span() noexcept : m_ptr(nullptr), m_count(0) {}
- constexpr Span(std::nullptr_t) noexcept : Span() {}
- constexpr Span(T* ptr, size_t count) noexcept : m_ptr(ptr), m_count(count) {}
- constexpr Span(T* ptr_begin, T* ptr_end) noexcept : m_ptr(ptr_begin), m_count(ptr_end - ptr_begin) {}
- constexpr Span(std::initializer_list<T> l) noexcept : m_ptr(l.begin()), m_count(l.size()) {}
-
- template<size_t N>
- constexpr Span(T (&arr)[N]) noexcept : Span(arr, N)
- {
- }
-
- Span(std::vector<T>& v) noexcept : Span(v.data(), v.size()) {}
- Span(const std::vector<std::remove_const_t<T>>& v) noexcept : Span(v.data(), v.size()) {}
-
- constexpr iterator begin() const { return m_ptr; }
- constexpr iterator end() const { return m_ptr + m_count; }
-
- constexpr reference operator[](size_t i) const { return m_ptr[i]; }
- constexpr size_t size() const { return m_count; }
-
-private:
- pointer m_ptr;
- size_t m_count;
-};
-
-template<class T>
-Span<T> make_span(std::vector<T>& v)
-{
- return {v.data(), v.size()};
-}
-
-template<class T>
-Span<const T> make_span(const std::vector<T>& v)
-{
- return {v.data(), v.size()};
-}
diff --git a/toolsrc/include/filesystem_fs.h b/toolsrc/include/filesystem_fs.h deleted file mode 100644 index 0651ebf25..000000000 --- a/toolsrc/include/filesystem_fs.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#include <filesystem> - -namespace fs -{ - namespace stdfs = std::experimental::filesystem; - - using stdfs::path; - using stdfs::copy_options; - using stdfs::file_status; - - inline bool is_regular_file(file_status s) { return stdfs::is_regular_file(s); } - inline bool is_directory(file_status s) { return stdfs::is_directory(s); } - inline bool status_known(file_status s) { return stdfs::status_known(s); } -}
\ No newline at end of file diff --git a/toolsrc/include/pch.h b/toolsrc/include/pch.h index 0f34063f8..5c31fbbd1 100644 --- a/toolsrc/include/pch.h +++ b/toolsrc/include/pch.h @@ -1,10 +1,22 @@ #pragma once +#if defined(_WIN32) #define NOMINMAX #define WIN32_LEAN_AND_MEAN + #pragma warning(suppress : 4768) #include <windows.h> +#pragma warning(suppress : 4768) +#include <Shlobj.h> + +#include <process.h> +#include <shellapi.h> +#include <winhttp.h> +#else +#include <unistd.h> +#endif + #include <algorithm> #include <array> #include <atomic> @@ -15,7 +27,12 @@ #include <cstdarg> #include <cstddef> #include <cstdint> +#if defined(_WIN32) #include <filesystem> +#else +#include <experimental/filesystem> +#endif +#include <cstring> #include <fstream> #include <functional> #include <iomanip> @@ -24,22 +41,17 @@ #include <map> #include <memory> #include <mutex> -#include <process.h> #include <regex> #include <set> -#include <shellapi.h> -#pragma warning(push) -#pragma warning(disable : 4768) -#include <Shlobj.h> -#pragma warning(pop) #include <stdexcept> #include <string> #include <sys/timeb.h> +#include <sys/types.h> #include <system_error> +#include <thread> #include <time.h> #include <type_traits> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> -#include <winhttp.h> diff --git a/toolsrc/include/vcpkg_Checks.h b/toolsrc/include/vcpkg/base/checks.h index ce486ac19..fb162c897 100644 --- a/toolsrc/include/vcpkg_Checks.h +++ b/toolsrc/include/vcpkg/base/checks.h @@ -1,7 +1,8 @@ #pragma once -#include "LineInfo.h" -#include "vcpkg_Strings.h" +#include <vcpkg/base/cstringview.h> +#include <vcpkg/base/lineinfo.h> +#include <vcpkg/base/strings.h> namespace vcpkg::Checks { diff --git a/toolsrc/include/vcpkg_Chrono.h b/toolsrc/include/vcpkg/base/chrono.h index c14019ff9..b525852f2 100644 --- a/toolsrc/include/vcpkg_Chrono.h +++ b/toolsrc/include/vcpkg/base/chrono.h @@ -3,7 +3,7 @@ #include <chrono> #include <string> -namespace vcpkg +namespace vcpkg::Chrono { class ElapsedTime { diff --git a/toolsrc/include/coff_file_reader.h b/toolsrc/include/vcpkg/base/cofffilereader.h index 7287211a1..ad2cc7b12 100644 --- a/toolsrc/include/coff_file_reader.h +++ b/toolsrc/include/vcpkg/base/cofffilereader.h @@ -1,6 +1,8 @@ #pragma once -#include "MachineType.h" -#include "filesystem_fs.h" + +#include <vcpkg/base/files.h> +#include <vcpkg/base/machinetype.h> + #include <vector> namespace vcpkg::CoffFileReader diff --git a/toolsrc/include/vcpkg/base/cstringview.h b/toolsrc/include/vcpkg/base/cstringview.h new file mode 100644 index 000000000..342455402 --- /dev/null +++ b/toolsrc/include/vcpkg/base/cstringview.h @@ -0,0 +1,69 @@ +#pragma once + +#include <string.h> +#include <string> + +namespace vcpkg +{ + struct CStringView + { + constexpr CStringView() : cstr(nullptr) {} + constexpr CStringView(const char* cstr) : cstr(cstr) {} + constexpr CStringView(const CStringView&) = default; + CStringView(const std::string& str) : cstr(str.c_str()) {} + + constexpr const char* c_str() const { return cstr; } + + private: + const char* cstr; + }; + + struct CWStringView + { + constexpr CWStringView() : cstr(nullptr) {} + constexpr CWStringView(const wchar_t* cstr) : cstr(cstr) {} + constexpr CWStringView(const CWStringView&) = default; + CWStringView(const std::wstring& str) : cstr(str.c_str()) {} + + constexpr const wchar_t* c_str() const { return cstr; } + + private: + const wchar_t* cstr; + }; + + namespace details + { + inline bool vcpkg_strcmp(const char* l, const char* r) { return strcmp(l, r) == 0; } + } + + inline bool operator==(const CStringView& l, const CStringView& r) + { + return details::vcpkg_strcmp(l.c_str(), r.c_str()); + } + + inline bool operator==(const char* l, const CStringView& r) { return details::vcpkg_strcmp(l, r.c_str()); } + + inline bool operator==(const CStringView& r, const char* l) { return details::vcpkg_strcmp(l, r.c_str()); } + + inline bool operator==(const std::string& l, const CStringView& r) { return l == r.c_str(); } + + inline bool operator==(const CStringView& r, const std::string& l) { return l == r.c_str(); } + + // notequals + inline bool operator!=(const CStringView& l, const CStringView& r) + { + return !details::vcpkg_strcmp(l.c_str(), r.c_str()); + } + + inline bool operator!=(const char* l, const CStringView& r) { return !details::vcpkg_strcmp(l, r.c_str()); } + + inline bool operator!=(const CStringView& r, const char* l) { return !details::vcpkg_strcmp(l, r.c_str()); } + + inline bool operator!=(const CStringView& r, const std::string& l) { return l != r.c_str(); } + + inline bool operator!=(const std::string& l, const CStringView& r) { return l != r.c_str(); } + + inline const char* to_printf_arg(const CStringView string_view) { return string_view.c_str(); } + + static_assert(sizeof(CStringView) == sizeof(void*), "CStringView must be a simple wrapper around char*"); +} diff --git a/toolsrc/include/vcpkg_Enums.h b/toolsrc/include/vcpkg/base/enums.h index c75feaa1f..6eca2cfe1 100644 --- a/toolsrc/include/vcpkg_Enums.h +++ b/toolsrc/include/vcpkg/base/enums.h @@ -1,5 +1,7 @@ #pragma once -#include "LineInfo.h" + +#include <vcpkg/base/lineinfo.h> + #include <string> namespace vcpkg::Enums diff --git a/toolsrc/include/vcpkg_expected.h b/toolsrc/include/vcpkg/base/expected.h index 9637ec087..b3b81ae81 100644 --- a/toolsrc/include/vcpkg_expected.h +++ b/toolsrc/include/vcpkg/base/expected.h @@ -1,6 +1,7 @@ #pragma once -#include "vcpkg_Checks.h" +#include <vcpkg/base/checks.h> + #include <system_error> namespace vcpkg @@ -32,7 +33,7 @@ namespace vcpkg ErrorHolder() = default; ErrorHolder(const std::error_code& err) : m_err(err) {} - constexpr bool has_error() const { return bool(m_err); } + bool has_error() const { return bool(m_err); } const std::error_code& error() const { return m_err; } std::error_code& error() { return m_err; } @@ -71,13 +72,13 @@ namespace vcpkg return std::move(this->m_t); } - const T& value_or_exit(const LineInfo& line_info) const & + const T& value_or_exit(const LineInfo& line_info) const& { exit_if_error(line_info); return this->m_t; } - const S& error() const & { return this->m_s.error(); } + const S& error() const& { return this->m_s.error(); } S&& error() && { return std::move(this->m_s.error()); } diff --git a/toolsrc/include/vcpkg_Files.h b/toolsrc/include/vcpkg/base/files.h index 855e8ea45..63cf3c6fd 100644 --- a/toolsrc/include/vcpkg_Files.h +++ b/toolsrc/include/vcpkg/base/files.h @@ -1,11 +1,29 @@ #pragma once -#include "filesystem_fs.h" -#include "vcpkg_expected.h" +#include <vcpkg/base/expected.h> + +#if defined(_WIN32) +#include <filesystem> +#else +#include <experimental/filesystem> +#endif + +namespace fs +{ + namespace stdfs = std::experimental::filesystem; + + using stdfs::copy_options; + using stdfs::file_status; + using stdfs::path; + + inline bool is_regular_file(file_status s) { return stdfs::is_regular_file(s); } + inline bool is_directory(file_status s) { return stdfs::is_directory(s); } + inline bool status_known(file_status s) { return stdfs::status_known(s); } +} namespace vcpkg::Files { - __interface Filesystem + struct Filesystem { virtual Expected<std::string> read_contents(const fs::path& file_path) const = 0; virtual Expected<std::vector<std::string>> read_lines(const fs::path& file_path) const = 0; @@ -26,8 +44,10 @@ namespace vcpkg::Files virtual bool create_directory(const fs::path& path, std::error_code& ec) = 0; virtual bool create_directories(const fs::path& path, std::error_code& ec) = 0; virtual void copy(const fs::path& oldpath, const fs::path& newpath, fs::copy_options opts) = 0; - virtual bool copy_file( - const fs::path& oldpath, const fs::path& newpath, fs::copy_options opts, std::error_code& ec) = 0; + virtual bool copy_file(const fs::path& oldpath, + const fs::path& newpath, + fs::copy_options opts, + std::error_code& ec) = 0; virtual fs::file_status status(const fs::path& path, std::error_code& ec) const = 0; }; @@ -39,5 +59,5 @@ namespace vcpkg::Files void print_paths(const std::vector<fs::path>& paths); - std::vector<fs::path> find_from_PATH(const std::wstring& name); + std::vector<fs::path> find_from_PATH(const std::string& name); } diff --git a/toolsrc/include/vcpkg_Graphs.h b/toolsrc/include/vcpkg/base/graphs.h index 13c0a7136..b585d2bb9 100644 --- a/toolsrc/include/vcpkg_Graphs.h +++ b/toolsrc/include/vcpkg/base/graphs.h @@ -3,6 +3,8 @@ #include <unordered_map> #include <unordered_set> +#include <vcpkg/base/checks.h> + namespace vcpkg::Graphs { enum class ExplorationStatus @@ -18,11 +20,11 @@ namespace vcpkg::Graphs }; template<class V, class U> - __interface AdjacencyProvider + struct AdjacencyProvider { - std::vector<V> adjacency_list(const U& vertex) const; + virtual std::vector<V> adjacency_list(const U& vertex) const = 0; - U load_vertex_data(const V& vertex) const; + virtual U load_vertex_data(const V& vertex) const = 0; }; template<class V, class U> diff --git a/toolsrc/include/lazy.h b/toolsrc/include/vcpkg/base/lazy.h index 58c11c002..58c11c002 100644 --- a/toolsrc/include/lazy.h +++ b/toolsrc/include/vcpkg/base/lazy.h diff --git a/toolsrc/include/LineInfo.h b/toolsrc/include/vcpkg/base/lineinfo.h index 62973462a..62973462a 100644 --- a/toolsrc/include/LineInfo.h +++ b/toolsrc/include/vcpkg/base/lineinfo.h diff --git a/toolsrc/include/MachineType.h b/toolsrc/include/vcpkg/base/machinetype.h index 6f61bbd53..b85cdbb0b 100644 --- a/toolsrc/include/MachineType.h +++ b/toolsrc/include/vcpkg/base/machinetype.h @@ -1,4 +1,5 @@ #pragma once + #include <cstdint> namespace vcpkg diff --git a/toolsrc/include/vcpkg_optional.h b/toolsrc/include/vcpkg/base/optional.h index 31a2d3e88..ff7a210c7 100644 --- a/toolsrc/include/vcpkg_optional.h +++ b/toolsrc/include/vcpkg/base/optional.h @@ -1,5 +1,6 @@ #pragma once -#include "vcpkg_Checks.h" + +#include <vcpkg/base/checks.h> namespace vcpkg { @@ -29,7 +30,7 @@ namespace vcpkg return std::move(this->m_t); } - const T& value_or_exit(const LineInfo& line_info) const & + const T& value_or_exit(const LineInfo& line_info) const& { this->exit_if_null(line_info); return this->m_t; @@ -40,7 +41,7 @@ namespace vcpkg constexpr bool has_value() const { return m_is_present; } template<class U> - T value_or(U&& default_value) const & + T value_or(U&& default_value) const& { return bool(*this) ? this->m_t : static_cast<T>(std::forward<U>(default_value)); } diff --git a/toolsrc/include/SortedVector.h b/toolsrc/include/vcpkg/base/sortedvector.h index 62808cc2f..62808cc2f 100644 --- a/toolsrc/include/SortedVector.h +++ b/toolsrc/include/vcpkg/base/sortedvector.h diff --git a/toolsrc/include/vcpkg/base/span.h b/toolsrc/include/vcpkg/base/span.h new file mode 100644 index 000000000..6be546351 --- /dev/null +++ b/toolsrc/include/vcpkg/base/span.h @@ -0,0 +1,60 @@ +#pragma once
+
+#include <array>
+#include <cstddef>
+#include <initializer_list>
+#include <vector>
+
+namespace vcpkg
+{
+ template<class T>
+ struct Span
+ {
+ public:
+ using element_type = T;
+ using pointer = T*;
+ using reference = T&;
+ using iterator = T*;
+
+ constexpr Span() noexcept : m_ptr(nullptr), m_count(0) {}
+ constexpr Span(std::nullptr_t) noexcept : Span() {}
+ constexpr Span(T* ptr, size_t count) noexcept : m_ptr(ptr), m_count(count) {}
+ constexpr Span(T* ptr_begin, T* ptr_end) noexcept : m_ptr(ptr_begin), m_count(ptr_end - ptr_begin) {}
+ constexpr Span(std::initializer_list<T> l) noexcept : m_ptr(l.begin()), m_count(l.size()) {}
+
+ template<size_t N>
+ constexpr Span(T (&arr)[N]) noexcept : Span(arr, N)
+ {
+ }
+
+ template<size_t N>
+ constexpr Span(const std::array<std::remove_const_t<T>, N>& arr) noexcept : Span(arr.data(), arr.size())
+ {
+ }
+
+ Span(std::vector<T>& v) noexcept : Span(v.data(), v.size()) {}
+ Span(const std::vector<std::remove_const_t<T>>& v) noexcept : Span(v.data(), v.size()) {}
+
+ constexpr iterator begin() const { return m_ptr; }
+ constexpr iterator end() const { return m_ptr + m_count; }
+
+ constexpr reference operator[](size_t i) const { return m_ptr[i]; }
+ constexpr size_t size() const { return m_count; }
+
+ private:
+ pointer m_ptr;
+ size_t m_count;
+ };
+
+ template<class T>
+ Span<T> make_span(std::vector<T>& v)
+ {
+ return {v.data(), v.size()};
+ }
+
+ template<class T>
+ Span<const T> make_span(const std::vector<T>& v)
+ {
+ return {v.data(), v.size()};
+ }
+}
\ No newline at end of file diff --git a/toolsrc/include/vcpkg_Strings.h b/toolsrc/include/vcpkg/base/strings.h index c44ce2b99..d263e3b6b 100644 --- a/toolsrc/include/vcpkg_Strings.h +++ b/toolsrc/include/vcpkg/base/strings.h @@ -1,6 +1,7 @@ #pragma once -#include "CStringView.h" +#include <vcpkg/base/cstringview.h> + #include <vector> namespace vcpkg::Strings::details @@ -15,30 +16,17 @@ namespace vcpkg::Strings::details inline const char* to_printf_arg(const char* s) { return s; } - inline int to_printf_arg(const int s) { return s; } - - inline long long to_printf_arg(const long long s) { return s; } - - inline unsigned long to_printf_arg(const unsigned long s) { return s; } - - inline size_t to_printf_arg(const size_t s) { return s; } - - inline double to_printf_arg(const double s) { return s; } + template<class T, class = std::enable_if_t<std::is_arithmetic<T>::value>> + T to_printf_arg(T s) + { + return s; + } std::string format_internal(const char* fmtstr, ...); - - inline const wchar_t* to_wprintf_arg(const std::wstring& s) { return s.c_str(); } - - inline const wchar_t* to_wprintf_arg(const wchar_t* s) { return s; } - - std::wstring wformat_internal(const wchar_t* fmtstr, ...); } namespace vcpkg::Strings { - static constexpr const char* EMPTY = ""; - static constexpr const wchar_t* WEMPTY = L""; - template<class... Args> std::string format(const char* fmtstr, const Args&... args) { @@ -46,39 +34,32 @@ namespace vcpkg::Strings return details::format_internal(fmtstr, to_printf_arg(to_printf_arg(args))...); } - template<class... Args> - std::wstring wformat(const wchar_t* fmtstr, const Args&... args) - { - using vcpkg::Strings::details::to_wprintf_arg; - return details::wformat_internal(fmtstr, to_wprintf_arg(to_wprintf_arg(args))...); - } - - std::wstring to_utf16(const CStringView s); + std::wstring to_utf16(const CStringView& s); - std::string to_utf8(const CWStringView w); + std::string to_utf8(const CWStringView& w); std::string::const_iterator case_insensitive_ascii_find(const std::string& s, const std::string& pattern); bool case_insensitive_ascii_contains(const std::string& s, const std::string& pattern); - int case_insensitive_ascii_compare(const CStringView left, const CStringView right); + bool case_insensitive_ascii_equals(const CStringView left, const CStringView right); std::string ascii_to_lowercase(const std::string& input); bool case_insensitive_ascii_starts_with(const std::string& s, const std::string& pattern); - template<class Container, class Transformer, class CharType> - std::basic_string<CharType> join(const CharType* delimiter, const Container& v, Transformer transformer) + template<class Container, class Transformer> + std::string join(const char* delimiter, const Container& v, Transformer transformer) { const auto begin = v.begin(); const auto end = v.end(); if (begin == end) { - return std::basic_string<CharType>(); + return std::string(); } - std::basic_string<CharType> output; + std::string output; output.append(transformer(*begin)); for (auto it = std::next(begin); it != end; ++it) { @@ -88,8 +69,8 @@ namespace vcpkg::Strings return output; } - template<class Container, class CharType> - std::basic_string<CharType> join(const CharType* delimiter, const Container& v) + template<class Container> + std::string join(const char* delimiter, const Container& v) { using Element = decltype(*v.begin()); return join(delimiter, v, [](const Element& x) -> const Element& { return x; }); diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg/base/system.h index 65f80ae6d..b396ef293 100644 --- a/toolsrc/include/vcpkg_System.h +++ b/toolsrc/include/vcpkg/base/system.h @@ -1,9 +1,8 @@ #pragma once -#include "filesystem_fs.h" -#include "vcpkg_Strings.h" -#include "vcpkg_optional.h" -#include <Windows.h> +#include <vcpkg/base/files.h> +#include <vcpkg/base/optional.h> +#include <vcpkg/base/strings.h> namespace vcpkg::System { @@ -17,13 +16,13 @@ namespace vcpkg::System std::string output; }; - int cmd_execute_clean(const CWStringView cmd_line); + int cmd_execute_clean(const CStringView cmd_line); - int cmd_execute(const CWStringView cmd_line); + int cmd_execute(const CStringView cmd_line); - ExitCodeAndOutput cmd_execute_and_capture_output(const CWStringView cmd_line); + ExitCodeAndOutput cmd_execute_and_capture_output(const CStringView cmd_line); - std::wstring create_powershell_script_cmd(const fs::path& script_path, const CWStringView args = Strings::WEMPTY); + std::string create_powershell_script_cmd(const fs::path& script_path, const CStringView args = ""); enum class Color { @@ -62,9 +61,9 @@ namespace vcpkg::System return System::println(c, Strings::format(messageTemplate, messageArg1, messageArgs...)); } - Optional<std::wstring> get_environment_variable(const CWStringView varname) noexcept; + Optional<std::string> get_environment_variable(const CStringView varname) noexcept; - Optional<std::wstring> get_registry_string(HKEY base, const CWStringView subkey, const CWStringView valuename); + Optional<std::string> get_registry_string(void* base_hkey, const CStringView subkey, const CStringView valuename); enum class CPUArchitecture { @@ -74,7 +73,7 @@ namespace vcpkg::System ARM64, }; - Optional<CPUArchitecture> to_cpu_architecture(CStringView arch); + Optional<CPUArchitecture> to_cpu_architecture(const CStringView& arch); CPUArchitecture get_host_processor(); diff --git a/toolsrc/include/vcpkg_Util.h b/toolsrc/include/vcpkg/base/util.h index facb7dd26..d5db6b6ee 100644 --- a/toolsrc/include/vcpkg_Util.h +++ b/toolsrc/include/vcpkg/base/util.h @@ -1,5 +1,6 @@ #pragma once +#include <algorithm> #include <map> #include <mutex> #include <utility> @@ -7,6 +8,18 @@ namespace vcpkg::Util { + template<class Container> + using ElementT = std::remove_reference_t<decltype(*begin(std::declval<Container>()))>; + + namespace Vectors + { + template<class Container, class T = ElementT<Container>> + void concatenate(std::vector<T>* augend, const Container& addend) + { + augend->insert(augend->end(), addend.begin(), addend.end()); + } + } + template<class Cont, class Func> using FmapOut = decltype(std::declval<Func>()(*begin(std::declval<Cont>()))); @@ -56,20 +69,21 @@ namespace vcpkg::Util } template<class Container, class V> - auto find(const Container& cont, V&& v) + auto find(Container&& cont, V&& v) { - return std::find(cont.cbegin(), cont.cend(), v); + using std::begin; + using std::end; + return std::find(begin(cont), end(cont), v); } template<class Container, class Pred> - auto find_if(const Container& cont, Pred pred) + auto find_if(Container&& cont, Pred pred) { - return std::find_if(cont.cbegin(), cont.cend(), pred); + using std::begin; + using std::end; + return std::find_if(begin(cont), end(cont), pred); } - template<class Container> - using ElementT = std::remove_reference_t<decltype(*begin(std::declval<Container>()))>; - template<class Container, class T = ElementT<Container>> std::vector<T*> element_pointers(Container&& cont) { @@ -77,13 +91,15 @@ namespace vcpkg::Util } template<class Container, class Pred> - auto find_if_not(const Container& cont, Pred pred) + auto find_if_not(Container&& cont, Pred pred) { - return std::find_if_not(cont.cbegin(), cont.cend(), pred); + using std::begin; + using std::end; + return std::find_if_not(begin(cont), end(cont), pred); } template<class K, class V, class Container, class Func> - void group_by(const Container& cont, std::map<K, std::vector<const V*>>* output, Func f) + void group_by(const Container& cont, std::map<K, std::vector<const V*>>* output, Func&& f) { for (const V& element : cont) { @@ -92,6 +108,12 @@ namespace vcpkg::Util } } + template<class AssocContainer, class K = std::decay_t<decltype(begin(std::declval<AssocContainer>())->first)>> + std::vector<K> extract_keys(AssocContainer&& input_map) + { + return fmap(input_map, [](auto&& p) { return p.first; }); + } + struct MoveOnlyBase { MoveOnlyBase() = default; @@ -141,4 +163,4 @@ namespace vcpkg::Util std::unique_lock<std::mutex> m_lock; T& m_ptr; }; -}
\ No newline at end of file +} diff --git a/toolsrc/include/BinaryParagraph.h b/toolsrc/include/vcpkg/binaryparagraph.h index 61e03343a..7eb50a6d7 100644 --- a/toolsrc/include/BinaryParagraph.h +++ b/toolsrc/include/vcpkg/binaryparagraph.h @@ -1,7 +1,8 @@ #pragma once -#include "PackageSpec.h" -#include "SourceParagraph.h" +#include <vcpkg/packagespec.h> +#include <vcpkg/sourceparagraph.h> + #include <unordered_map> namespace vcpkg diff --git a/toolsrc/include/vcpkg_Build.h b/toolsrc/include/vcpkg/build.h index 5ba675757..774e25922 100644 --- a/toolsrc/include/vcpkg_Build.h +++ b/toolsrc/include/vcpkg/build.h @@ -1,11 +1,14 @@ #pragma once -#include "CStringView.h" -#include "PackageSpec.h" -#include "StatusParagraphs.h" -#include "VcpkgPaths.h" -#include "vcpkg_Files.h" -#include "vcpkg_optional.h" +#include <vcpkg/packagespec.h> +#include <vcpkg/statusparagraphs.h> +#include <vcpkg/triplet.h> +#include <vcpkg/vcpkgcmdarguments.h> +#include <vcpkg/vcpkgpaths.h> + +#include <vcpkg/base/cstringview.h> +#include <vcpkg/base/files.h> +#include <vcpkg/base/optional.h> #include <array> #include <map> @@ -13,6 +16,16 @@ namespace vcpkg::Build { + namespace Command + { + void perform_and_exit(const FullPackageSpec& full_spec, + const fs::path& port_dir, + const std::unordered_set<std::string>& options, + const VcpkgPaths& paths); + + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); + } + enum class UseHeadVersion { NO = 0, @@ -83,7 +96,7 @@ namespace vcpkg::Build Optional<fs::path> visual_studio_path; }; - std::wstring make_build_env_cmd(const PreBuildInfo& pre_build_info, const Toolset& toolset); + std::string make_build_env_cmd(const PreBuildInfo& pre_build_info, const Toolset& toolset); struct ExtendedBuildResult { diff --git a/toolsrc/include/vcpkg/commands.h b/toolsrc/include/vcpkg/commands.h new file mode 100644 index 000000000..e00812c98 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.h @@ -0,0 +1,135 @@ +#pragma once + +#include <vcpkg/build.h> +#include <vcpkg/dependencies.h> +#include <vcpkg/statusparagraphs.h> +#include <vcpkg/vcpkgcmdarguments.h> +#include <vcpkg/vcpkgpaths.h> + +#include <array> + +namespace vcpkg::Commands +{ + using CommandTypeA = void (*)(const VcpkgCmdArguments& args, + const VcpkgPaths& paths, + const Triplet& default_triplet); + using CommandTypeB = void (*)(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + using CommandTypeC = void (*)(const VcpkgCmdArguments& args); + + namespace BuildExternal + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); + } + + namespace CI + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); + } + + namespace Env + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); + } + + namespace Create + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace Edit + { + extern const CommandStructure COMMAND_STRUCTURE; + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace DependInfo + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace Search + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace List + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace Owns + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace Cache + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace Import + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace Integrate + { + extern const char* const INTEGRATE_COMMAND_HELPSTRING; + + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace PortsDiff + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace Autocomplete + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace Version + { + const std::string& version(); + void warn_if_vcpkg_version_mismatch(const VcpkgPaths& paths); + void perform_and_exit(const VcpkgCmdArguments& args); + } + + namespace Contact + { + const std::string& email(); + void perform_and_exit(const VcpkgCmdArguments& args); + } + + namespace Hash + { + void perform_and_exit(const VcpkgCmdArguments& args); + } + + template<class T> + struct PackageNameAndFunction + { + std::string name; + T function; + }; + + Span<const PackageNameAndFunction<CommandTypeA>> get_available_commands_type_a(); + Span<const PackageNameAndFunction<CommandTypeB>> get_available_commands_type_b(); + Span<const PackageNameAndFunction<CommandTypeC>> get_available_commands_type_c(); + + template<typename T> + T find(const std::string& command_name, const std::vector<PackageNameAndFunction<T>> available_commands) + { + for (const PackageNameAndFunction<T>& cmd : available_commands) + { + if (cmd.name == command_name) + { + return cmd.function; + } + } + + // not found + return nullptr; + } +} diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg/dependencies.h index d67122e48..585338ae2 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg/dependencies.h @@ -1,10 +1,12 @@ #pragma once -#include "PackageSpec.h" -#include "StatusParagraphs.h" -#include "VcpkgPaths.h" -#include "vcpkg_Graphs.h" -#include "vcpkg_Util.h" -#include "vcpkg_optional.h" + +#include <vcpkg/base/graphs.h> +#include <vcpkg/base/optional.h> +#include <vcpkg/base/util.h> +#include <vcpkg/packagespec.h> +#include <vcpkg/statusparagraphs.h> +#include <vcpkg/vcpkgpaths.h> + #include <vector> namespace vcpkg::Dependencies @@ -113,7 +115,10 @@ namespace vcpkg::Dependencies RequestType request_type; }; - __interface PortFileProvider { virtual const SourceControlFile& get_control_file(const std::string& spec) const; }; + struct PortFileProvider + { + virtual const SourceControlFile& get_control_file(const std::string& spec) const = 0; + }; struct MapPortFile : Util::ResourceBase, PortFileProvider { diff --git a/toolsrc/include/vcpkg/export.h b/toolsrc/include/vcpkg/export.h new file mode 100644 index 000000000..f3285e187 --- /dev/null +++ b/toolsrc/include/vcpkg/export.h @@ -0,0 +1,10 @@ +#pragma once + +#include <vcpkg/vcpkgpaths.h> + +namespace vcpkg::Export +{ + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); + + void export_integration_files(const fs::path& raw_exported_dir_path, const VcpkgPaths& paths); +} diff --git a/toolsrc/include/vcpkg_Commands_Export_IFW.h b/toolsrc/include/vcpkg/export.ifw.h index 7bee45eaf..d28a4436d 100644 --- a/toolsrc/include/vcpkg_Commands_Export_IFW.h +++ b/toolsrc/include/vcpkg/export.ifw.h @@ -1,13 +1,14 @@ #pragma once -#include "VcpkgPaths.h" -#include "vcpkg_Dependencies.h" -#include "vcpkg_Files.h" +#include <vcpkg/dependencies.h> +#include <vcpkg/vcpkgpaths.h> + +#include <vcpkg/base/files.h> #include <string> #include <vector> -namespace vcpkg::Commands::Export::IFW +namespace vcpkg::Export::IFW { struct Options { diff --git a/toolsrc/include/vcpkg_GlobalState.h b/toolsrc/include/vcpkg/globalstate.h index 6522a25bf..7cea361cf 100644 --- a/toolsrc/include/vcpkg_GlobalState.h +++ b/toolsrc/include/vcpkg/globalstate.h @@ -1,15 +1,15 @@ #pragma once -#include <atomic> +#include <vcpkg/base/chrono.h> +#include <vcpkg/base/util.h> -#include "vcpkg_Chrono.h" -#include "vcpkg_Util.h" +#include <atomic> namespace vcpkg { struct GlobalState { - static Util::LockGuarded<ElapsedTime> timer; + static Util::LockGuarded<Chrono::ElapsedTime> timer; static std::atomic<bool> debugging; static std::atomic<bool> feature_packages; diff --git a/toolsrc/include/vcpkg/help.h b/toolsrc/include/vcpkg/help.h new file mode 100644 index 000000000..39ad6912d --- /dev/null +++ b/toolsrc/include/vcpkg/help.h @@ -0,0 +1,19 @@ +#pragma once + +#include <vcpkg/vcpkgcmdarguments.h> +#include <vcpkg/vcpkgpaths.h> + +#include <string> + +namespace vcpkg::Help +{ + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + + void help_topic_valid_triplet(const VcpkgPaths& paths); + + void print_usage(); + + void print_example(const std::string& command_and_arguments); + + std::string create_example_string(const std::string& command_and_arguments); +} diff --git a/toolsrc/include/vcpkg_Input.h b/toolsrc/include/vcpkg/input.h index fa568207a..621139427 100644 --- a/toolsrc/include/vcpkg_Input.h +++ b/toolsrc/include/vcpkg/input.h @@ -1,5 +1,6 @@ #pragma once -#include "PackageSpec.h" + +#include <vcpkg/packagespec.h> namespace vcpkg::Input { diff --git a/toolsrc/include/vcpkg/install.h b/toolsrc/include/vcpkg/install.h new file mode 100644 index 000000000..db6055f4f --- /dev/null +++ b/toolsrc/include/vcpkg/install.h @@ -0,0 +1,71 @@ +#pragma once + +#include <vcpkg/build.h> +#include <vcpkg/dependencies.h> +#include <vcpkg/vcpkgcmdarguments.h> +#include <vcpkg/vcpkgpaths.h> + +#include <vector> + +namespace vcpkg::Install +{ + enum class KeepGoing + { + NO = 0, + YES + }; + + inline KeepGoing to_keep_going(const bool value) { return value ? KeepGoing::YES : KeepGoing::NO; } + + enum class PrintSummary + { + NO = 0, + YES + }; + + inline PrintSummary to_print_summary(const bool value) { return value ? PrintSummary::YES : PrintSummary::NO; } + + struct InstallDir + { + static InstallDir from_destination_root(const fs::path& destination_root, + const std::string& destination_subdirectory, + const fs::path& listfile); + + private: + fs::path m_destination; + std::string m_destination_subdirectory; + fs::path m_listfile; + + public: + const fs::path& destination() const; + const std::string& destination_subdirectory() const; + const fs::path& listfile() const; + }; + + Build::BuildResult perform_install_plan_action(const VcpkgPaths& paths, + const Dependencies::InstallPlanAction& action, + const Build::BuildPackageOptions& install_plan_options, + StatusParagraphs& status_db); + + enum class InstallResult + { + FILE_CONFLICTS, + SUCCESS, + }; + + void install_files_and_write_listfile(Files::Filesystem& fs, const fs::path& source_dir, const InstallDir& dirs); + InstallResult install_package(const VcpkgPaths& paths, + const BinaryControlFile& binary_paragraph, + StatusParagraphs* status_db); + + void perform_and_exit_ex(const std::vector<Dependencies::AnyAction>& action_plan, + const Build::BuildPackageOptions& install_plan_options, + const KeepGoing keep_going, + const PrintSummary print_summary, + const VcpkgPaths& paths, + StatusParagraphs& status_db); + + extern const CommandStructure COMMAND_STRUCTURE; + + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); +} diff --git a/toolsrc/include/metrics.h b/toolsrc/include/vcpkg/metrics.h index 8eae426de..f73c636cf 100644 --- a/toolsrc/include/metrics.h +++ b/toolsrc/include/vcpkg/metrics.h @@ -1,8 +1,8 @@ #pragma once -#include <string> +#include <vcpkg/base/util.h> -#include "vcpkg_Util.h" +#include <string> namespace vcpkg::Metrics { @@ -15,7 +15,6 @@ namespace vcpkg::Metrics void track_metric(const std::string& name, double value); void track_property(const std::string& name, const std::string& value); - void track_property(const std::string& name, const std::wstring& value); void upload(const std::string& payload); void flush(); @@ -23,6 +22,6 @@ namespace vcpkg::Metrics extern Util::LockGuarded<Metrics> g_metrics; - std::wstring get_SQM_user(); + std::string get_SQM_user(); bool get_compiled_metrics_enabled(); } diff --git a/toolsrc/include/PackageSpec.h b/toolsrc/include/vcpkg/packagespec.h index c5ce767f9..60c99782e 100644 --- a/toolsrc/include/PackageSpec.h +++ b/toolsrc/include/vcpkg/packagespec.h @@ -1,8 +1,8 @@ #pragma once -#include "PackageSpecParseResult.h" -#include "Triplet.h" -#include "vcpkg_expected.h" +#include <vcpkg/base/expected.h> +#include <vcpkg/packagespecparseresult.h> +#include <vcpkg/triplet.h> namespace vcpkg { @@ -76,20 +76,23 @@ namespace vcpkg bool operator!=(const PackageSpec& left, const PackageSpec& right); } -template<> -struct std::hash<vcpkg::PackageSpec> +namespace std { - size_t operator()(const vcpkg::PackageSpec& value) const + template<> + struct hash<vcpkg::PackageSpec> { - size_t hash = 17; - hash = hash * 31 + std::hash<std::string>()(value.name()); - hash = hash * 31 + std::hash<vcpkg::Triplet>()(value.triplet()); - return hash; - } -}; - -template<> -struct std::equal_to<vcpkg::PackageSpec> -{ - bool operator()(const vcpkg::PackageSpec& left, const vcpkg::PackageSpec& right) const { return left == right; } -}; + size_t operator()(const vcpkg::PackageSpec& value) const + { + size_t hash = 17; + hash = hash * 31 + std::hash<std::string>()(value.name()); + hash = hash * 31 + std::hash<vcpkg::Triplet>()(value.triplet()); + return hash; + } + }; + + template<> + struct equal_to<vcpkg::PackageSpec> + { + bool operator()(const vcpkg::PackageSpec& left, const vcpkg::PackageSpec& right) const { return left == right; } + }; +} diff --git a/toolsrc/include/PackageSpecParseResult.h b/toolsrc/include/vcpkg/packagespecparseresult.h index 1462b8073..dd91c9a67 100644 --- a/toolsrc/include/PackageSpecParseResult.h +++ b/toolsrc/include/vcpkg/packagespecparseresult.h @@ -1,6 +1,7 @@ #pragma once -#include "vcpkg_expected.h" +#include <vcpkg/base/cstringview.h> +#include <vcpkg/base/expected.h> namespace vcpkg { @@ -19,7 +20,7 @@ namespace vcpkg ErrorHolder() : m_err(PackageSpecParseResult::SUCCESS) {} ErrorHolder(PackageSpecParseResult err) : m_err(err) {} - constexpr bool has_error() const { return m_err != PackageSpecParseResult::SUCCESS; } + bool has_error() const { return m_err != PackageSpecParseResult::SUCCESS; } const PackageSpecParseResult& error() const { return m_err; } PackageSpecParseResult& error() { return m_err; } diff --git a/toolsrc/include/ParagraphParseResult.h b/toolsrc/include/vcpkg/paragraphparseresult.h index eaa7e6327..558715bbc 100644 --- a/toolsrc/include/ParagraphParseResult.h +++ b/toolsrc/include/vcpkg/paragraphparseresult.h @@ -1,4 +1,5 @@ #pragma once + #include <system_error> namespace vcpkg @@ -25,8 +26,11 @@ namespace vcpkg ParagraphParseResult to_paragraph_parse_result(std::error_code ec); } -// Enable implicit conversion to std::error_code -template<> -struct std::is_error_code_enum<vcpkg::ParagraphParseResult> : ::std::true_type +namespace std { -}; + // Enable implicit conversion to std::error_code + template<> + struct is_error_code_enum<vcpkg::ParagraphParseResult> : ::std::true_type + { + }; +}
\ No newline at end of file diff --git a/toolsrc/include/Paragraphs.h b/toolsrc/include/vcpkg/paragraphs.h index aae46f7da..c8dbea646 100644 --- a/toolsrc/include/Paragraphs.h +++ b/toolsrc/include/vcpkg/paragraphs.h @@ -1,13 +1,13 @@ #pragma once -#include <map> +#include <vcpkg/binaryparagraph.h> +#include <vcpkg/parse.h> +#include <vcpkg/vcpkgpaths.h> +#include <vcpkg/versiont.h> + +#include <vcpkg/base/expected.h> -#include "BinaryParagraph.h" -#include "VcpkgPaths.h" -#include "VersionT.h" -#include "filesystem_fs.h" -#include "vcpkg_Parse.h" -#include "vcpkg_expected.h" +#include <map> namespace vcpkg::Paragraphs { diff --git a/toolsrc/include/vcpkg_Parse.h b/toolsrc/include/vcpkg/parse.h index 2dda033b3..4b33e302e 100644 --- a/toolsrc/include/vcpkg_Parse.h +++ b/toolsrc/include/vcpkg/parse.h @@ -1,11 +1,11 @@ #pragma once +#include <vcpkg/base/expected.h> +#include <vcpkg/base/optional.h> + #include <memory> #include <unordered_map> -#include "vcpkg_expected.h" -#include "vcpkg_optional.h" - namespace vcpkg::Parse { struct ParseControlErrorInfo diff --git a/toolsrc/include/PostBuildLint_BuildType.h b/toolsrc/include/vcpkg/postbuildlint.buildtype.h index 38ad3084e..ff651fd7a 100644 --- a/toolsrc/include/PostBuildLint_BuildType.h +++ b/toolsrc/include/vcpkg/postbuildlint.buildtype.h @@ -1,6 +1,8 @@ #pragma once -#include "CStringView.h" -#include "vcpkg_Build.h" + +#include <vcpkg/base/cstringview.h> +#include <vcpkg/build.h> + #include <array> #include <regex> diff --git a/toolsrc/include/PostBuildLint.h b/toolsrc/include/vcpkg/postbuildlint.h index 69fafc9f7..5dcfeb8df 100644 --- a/toolsrc/include/PostBuildLint.h +++ b/toolsrc/include/vcpkg/postbuildlint.h @@ -1,7 +1,8 @@ #pragma once -#include "PackageSpec.h" -#include "VcpkgPaths.h" -#include "vcpkg_Build.h" + +#include <vcpkg/build.h> +#include <vcpkg/packagespec.h> +#include <vcpkg/vcpkgpaths.h> namespace vcpkg::PostBuildLint { diff --git a/toolsrc/include/vcpkg/remove.h b/toolsrc/include/vcpkg/remove.h new file mode 100644 index 000000000..6d8a3ebe9 --- /dev/null +++ b/toolsrc/include/vcpkg/remove.h @@ -0,0 +1,26 @@ +#pragma once + +#include <vcpkg/dependencies.h> +#include <vcpkg/vcpkgcmdarguments.h> +#include <vcpkg/vcpkgpaths.h> + +namespace vcpkg::Remove +{ + enum class Purge + { + NO = 0, + YES + }; + + inline Purge to_purge(const bool value) { return value ? Purge::YES : Purge::NO; } + + void perform_remove_plan_action(const VcpkgPaths& paths, + const Dependencies::RemovePlanAction& action, + const Purge purge, + StatusParagraphs& status_db); + + extern const CommandStructure COMMAND_STRUCTURE; + + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); + void remove_package(const VcpkgPaths& paths, const PackageSpec& spec, StatusParagraphs* status_db); +} diff --git a/toolsrc/include/SourceParagraph.h b/toolsrc/include/vcpkg/sourceparagraph.h index ccf9faf4f..dcbbc1c3b 100644 --- a/toolsrc/include/SourceParagraph.h +++ b/toolsrc/include/vcpkg/sourceparagraph.h @@ -1,10 +1,11 @@ #pragma once -#include "PackageSpec.h" -#include "Span.h" -#include "vcpkg_Parse.h" -#include "vcpkg_System.h" -#include "vcpkg_expected.h" +#include <vcpkg/packagespec.h> +#include <vcpkg/parse.h> + +#include <vcpkg/base/expected.h> +#include <vcpkg/base/span.h> +#include <vcpkg/base/system.h> #include <string> #include <vector> diff --git a/toolsrc/include/StatusParagraph.h b/toolsrc/include/vcpkg/statusparagraph.h index b56533d65..ca84b1bb7 100644 --- a/toolsrc/include/StatusParagraph.h +++ b/toolsrc/include/vcpkg/statusparagraph.h @@ -1,6 +1,7 @@ #pragma once -#include "BinaryParagraph.h" +#include <vcpkg/binaryparagraph.h> + #include <unordered_map> namespace vcpkg diff --git a/toolsrc/include/StatusParagraphs.h b/toolsrc/include/vcpkg/statusparagraphs.h index 1a9ee6a03..c2f3b7b8e 100644 --- a/toolsrc/include/StatusParagraphs.h +++ b/toolsrc/include/vcpkg/statusparagraphs.h @@ -1,5 +1,6 @@ #pragma once -#include "StatusParagraph.h" +#include <vcpkg/statusparagraph.h> + #include <iterator> #include <memory> diff --git a/toolsrc/include/triplet.h b/toolsrc/include/vcpkg/triplet.h index 46a52f8e6..50d731593 100644 --- a/toolsrc/include/triplet.h +++ b/toolsrc/include/vcpkg/triplet.h @@ -36,8 +36,11 @@ namespace vcpkg bool operator!=(const Triplet& left, const Triplet& right); } -template<> -struct std::hash<vcpkg::Triplet> +namespace std { - size_t operator()(const vcpkg::Triplet& t) const { return t.hash_code(); } -}; + template<> + struct hash<vcpkg::Triplet> + { + size_t operator()(const vcpkg::Triplet& t) const { return t.hash_code(); } + }; +}
\ No newline at end of file diff --git a/toolsrc/include/vcpkg/update.h b/toolsrc/include/vcpkg/update.h new file mode 100644 index 000000000..e7303d1b0 --- /dev/null +++ b/toolsrc/include/vcpkg/update.h @@ -0,0 +1,21 @@ +#pragma once + +#include <vcpkg/packagespec.h> +#include <vcpkg/statusparagraphs.h> +#include <vcpkg/vcpkgcmdarguments.h> +#include <vcpkg/vcpkgpaths.h> +#include <vcpkg/versiont.h> + +namespace vcpkg::Update +{ + struct OutdatedPackage + { + static bool compare_by_name(const OutdatedPackage& left, const OutdatedPackage& right); + + PackageSpec spec; + VersionDiff version_diff; + }; + + std::vector<OutdatedPackage> find_outdated_packages(const VcpkgPaths& paths, const StatusParagraphs& status_db); + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); +}
\ No newline at end of file diff --git a/toolsrc/include/VcpkgCmdArguments.h b/toolsrc/include/vcpkg/vcpkgcmdarguments.h index 0de5747b1..d9895f4b8 100644 --- a/toolsrc/include/VcpkgCmdArguments.h +++ b/toolsrc/include/vcpkg/vcpkgcmdarguments.h @@ -1,6 +1,9 @@ #pragma once -#include "vcpkg_optional.h" +#include <vcpkg/base/cstringview.h> +#include <vcpkg/base/optional.h> +#include <vcpkg/base/span.h> + #include <memory> #include <unordered_map> #include <unordered_set> @@ -16,7 +19,11 @@ namespace vcpkg struct VcpkgCmdArguments { +#if defined(_WIN32) static VcpkgCmdArguments create_from_command_line(const int argc, const wchar_t* const* const argv); +#else + static VcpkgCmdArguments create_from_command_line(const int argc, const char* const* const argv); +#endif static VcpkgCmdArguments create_from_arg_sequence(const std::string* arg_begin, const std::string* arg_end); std::unique_ptr<std::string> vcpkg_root_dir; @@ -46,4 +53,19 @@ namespace vcpkg private: std::unordered_map<std::string, Optional<std::string>> optional_command_arguments; }; + + struct VcpkgPaths; + + struct CommandStructure + { + CStringView example_text; + + size_t minimum_arity; + size_t maximum_arity; + + Span<const std::string> switches; + Span<const std::string> settings; + + std::vector<std::string> (*valid_arguments)(const VcpkgPaths& paths); + }; } diff --git a/toolsrc/include/vcpkglib.h b/toolsrc/include/vcpkg/vcpkglib.h index 0bb75f9b5..9a7fdb861 100644 --- a/toolsrc/include/vcpkglib.h +++ b/toolsrc/include/vcpkg/vcpkglib.h @@ -1,8 +1,8 @@ #pragma once -#include "SortedVector.h" -#include "StatusParagraphs.h" -#include "VcpkgPaths.h" +#include <vcpkg/base/sortedvector.h> +#include <vcpkg/statusparagraphs.h> +#include <vcpkg/vcpkgpaths.h> namespace vcpkg { @@ -22,17 +22,16 @@ namespace vcpkg struct CMakeVariable { - CMakeVariable(const CWStringView varname, const wchar_t* varvalue); - CMakeVariable(const CWStringView varname, const std::string& varvalue); - CMakeVariable(const CWStringView varname, const std::wstring& varvalue); - CMakeVariable(const CWStringView varname, const fs::path& path); + CMakeVariable(const CStringView varname, const char* varvalue); + CMakeVariable(const CStringView varname, const std::string& varvalue); + CMakeVariable(const CStringView varname, const fs::path& path); - std::wstring s; + std::string s; }; - std::wstring make_cmake_cmd(const fs::path& cmake_exe, - const fs::path& cmake_script, - const std::vector<CMakeVariable>& pass_variables); + std::string make_cmake_cmd(const fs::path& cmake_exe, + const fs::path& cmake_script, + const std::vector<CMakeVariable>& pass_variables); std::string shorten_text(const std::string& desc, size_t length); } // namespace vcpkg diff --git a/toolsrc/include/VcpkgPaths.h b/toolsrc/include/vcpkg/vcpkgpaths.h index d4640fba2..781dabd1a 100644 --- a/toolsrc/include/VcpkgPaths.h +++ b/toolsrc/include/vcpkg/vcpkgpaths.h @@ -1,16 +1,17 @@ #pragma once -#include "BinaryParagraph.h" -#include "Lazy.h" -#include "PackageSpec.h" -#include "filesystem_fs.h" -#include "vcpkg_Files.h" -#include "vcpkg_expected.h" + +#include <vcpkg/binaryparagraph.h> +#include <vcpkg/packagespec.h> + +#include <vcpkg/base/expected.h> +#include <vcpkg/base/files.h> +#include <vcpkg/base/lazy.h> namespace vcpkg { struct ToolsetArchOption { - CWStringView name; + CStringView name; System::CPUArchitecture host_arch; System::CPUArchitecture target_arch; }; @@ -20,8 +21,8 @@ namespace vcpkg fs::path visual_studio_root_path; fs::path dumpbin; fs::path vcvarsall; - std::vector<std::wstring> vcvarsall_options; - CWStringView version; + std::vector<std::string> vcvarsall_options; + CStringView version; std::vector<ToolsetArchOption> supported_architectures; }; @@ -35,6 +36,7 @@ namespace vcpkg fs::path build_info_file_path(const PackageSpec& spec) const; fs::path listfile_path(const BinaryParagraph& pgh) const; + const std::vector<std::string>& get_available_triplets() const; bool is_valid_triplet(const Triplet& t) const; fs::path root; @@ -67,12 +69,13 @@ namespace vcpkg /// <remarks> /// Valid version strings are "v140", "v141", and "". Empty string gets the latest. /// </remarks> - const Toolset& VcpkgPaths::get_toolset(const Optional<std::string>& toolset_version, - const Optional<fs::path>& visual_studio_path) const; + const Toolset& get_toolset(const Optional<std::string>& toolset_version, + const Optional<fs::path>& visual_studio_path) const; Files::Filesystem& get_filesystem() const; private: + Lazy<std::vector<std::string>> available_triplets; Lazy<fs::path> cmake_exe; Lazy<fs::path> git_exe; Lazy<fs::path> nuget_exe; diff --git a/toolsrc/include/VersionT.h b/toolsrc/include/vcpkg/versiont.h index 67efd8da3..67efd8da3 100644 --- a/toolsrc/include/VersionT.h +++ b/toolsrc/include/vcpkg/versiont.h diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h deleted file mode 100644 index 7cfa2760e..000000000 --- a/toolsrc/include/vcpkg_Commands.h +++ /dev/null @@ -1,258 +0,0 @@ -#pragma once - -#include "StatusParagraphs.h" -#include "VcpkgCmdArguments.h" -#include "VcpkgPaths.h" -#include "VersionT.h" -#include "vcpkg_Build.h" -#include "vcpkg_Dependencies.h" -#include <array> - -namespace vcpkg::Commands -{ - using CommandTypeA = void (*)(const VcpkgCmdArguments& args, - const VcpkgPaths& paths, - const Triplet& default_triplet); - using CommandTypeB = void (*)(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - using CommandTypeC = void (*)(const VcpkgCmdArguments& args); - - namespace BuildCommand - { - void perform_and_exit(const FullPackageSpec& full_spec, - const fs::path& port_dir, - const std::unordered_set<std::string>& options, - const VcpkgPaths& paths); - - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); - } - - namespace BuildExternal - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); - } - - namespace Install - { - enum class KeepGoing - { - NO = 0, - YES - }; - - inline KeepGoing to_keep_going(const bool value) { return value ? KeepGoing::YES : KeepGoing::NO; } - - enum class PrintSummary - { - NO = 0, - YES - }; - - inline PrintSummary to_print_summary(const bool value) { return value ? PrintSummary::YES : PrintSummary::NO; } - - struct InstallDir - { - static InstallDir from_destination_root(const fs::path& destination_root, - const std::string& destination_subdirectory, - const fs::path& listfile); - - private: - fs::path m_destination; - std::string m_destination_subdirectory; - fs::path m_listfile; - - public: - const fs::path& destination() const; - const std::string& destination_subdirectory() const; - const fs::path& listfile() const; - }; - - Build::BuildResult perform_install_plan_action(const VcpkgPaths& paths, - const Dependencies::InstallPlanAction& action, - const Build::BuildPackageOptions& install_plan_options, - StatusParagraphs& status_db); - - enum class InstallResult - { - FILE_CONFLICTS, - SUCCESS, - }; - - void install_files_and_write_listfile(Files::Filesystem& fs, - const fs::path& source_dir, - const InstallDir& dirs); - InstallResult install_package(const VcpkgPaths& paths, - const BinaryControlFile& binary_paragraph, - StatusParagraphs* status_db); - - void perform_and_exit(const std::vector<Dependencies::AnyAction>& action_plan, - const Build::BuildPackageOptions& install_plan_options, - const KeepGoing keep_going, - const PrintSummary print_summary, - const VcpkgPaths& paths, - StatusParagraphs& status_db); - - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); - } - - namespace Export - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); - } - - namespace CI - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); - } - - namespace Remove - { - enum class Purge - { - NO = 0, - YES - }; - - inline Purge to_purge(const bool value) { return value ? Purge::YES : Purge::NO; } - - void perform_remove_plan_action(const VcpkgPaths& paths, - const Dependencies::RemovePlanAction& action, - const Purge purge, - StatusParagraphs& status_db); - - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); - void remove_package(const VcpkgPaths& paths, const PackageSpec& spec, StatusParagraphs* status_db); - } - - namespace Update - { - struct OutdatedPackage - { - static bool compare_by_name(const OutdatedPackage& left, const OutdatedPackage& right); - - PackageSpec spec; - VersionDiff version_diff; - }; - - std::vector<OutdatedPackage> find_outdated_packages(const VcpkgPaths& paths, const StatusParagraphs& status_db); - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Env - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); - } - - namespace Create - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Edit - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace DependInfo - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Search - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace List - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Owns - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Cache - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Import - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Integrate - { - extern const char* const INTEGRATE_COMMAND_HELPSTRING; - - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace PortsDiff - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Autocomplete - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Help - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - - void help_topic_valid_triplet(const VcpkgPaths& paths); - - void print_usage(); - - void print_example(const std::string& command_and_arguments); - - std::string create_example_string(const std::string& command_and_arguments); - } - - namespace Version - { - const std::string& version(); - void warn_if_vcpkg_version_mismatch(const VcpkgPaths& paths); - void perform_and_exit(const VcpkgCmdArguments& args); - } - - namespace Contact - { - const std::string& email(); - void perform_and_exit(const VcpkgCmdArguments& args); - } - - namespace Hash - { - void perform_and_exit(const VcpkgCmdArguments& args); - } - - template<class T> - struct PackageNameAndFunction - { - std::string name; - T function; - }; - - const std::vector<PackageNameAndFunction<CommandTypeA>>& get_available_commands_type_a(); - const std::vector<PackageNameAndFunction<CommandTypeB>>& get_available_commands_type_b(); - const std::vector<PackageNameAndFunction<CommandTypeC>>& get_available_commands_type_c(); - - template<typename T> - T find(const std::string& command_name, const std::vector<PackageNameAndFunction<T>> available_commands) - { - for (const PackageNameAndFunction<T>& cmd : available_commands) - { - if (cmd.name == command_name) - { - return cmd.function; - } - } - - // not found - return nullptr; - } -} diff --git a/toolsrc/include/vcpkg_Commands_Export.h b/toolsrc/include/vcpkg_Commands_Export.h deleted file mode 100644 index 6e698c1b4..000000000 --- a/toolsrc/include/vcpkg_Commands_Export.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -#include "VcpkgPaths.h" - -namespace vcpkg::Commands::Export -{ - void export_integration_files(const fs::path& raw_exported_dir_path, const VcpkgPaths& paths); -} diff --git a/toolsrc/include/vcpkg_Maps.h b/toolsrc/include/vcpkg_Maps.h deleted file mode 100644 index aadd81c2b..000000000 --- a/toolsrc/include/vcpkg_Maps.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -#include <map> -#include <unordered_map> -#include <unordered_set> - -namespace vcpkg::Maps -{ - template<typename K, typename V> - std::vector<K> extract_keys(const std::unordered_map<K, V>& input_map) - { - std::vector<K> key_set; - for (auto const& element : input_map) - { - key_set.push_back(element.first); - } - return key_set; - } - - template<typename K, typename V> - std::vector<K> extract_keys(const std::map<K, V>& input_map) - { - std::vector<K> key_set; - for (auto const& element : input_map) - { - key_set.push_back(element.first); - } - return key_set; - } -} |
