From 4d34488649fe5d71b8a553706d960a3784c56bb1 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Fri, 18 Aug 2017 20:32:35 -0700 Subject: [vcpkg] Consolidate specifier parsing --- toolsrc/include/PackageSpec.h | 9 +++++++++ toolsrc/include/vcpkg_Checks.h | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/PackageSpec.h b/toolsrc/include/PackageSpec.h index 15b5e5b9b..77a14e90e 100644 --- a/toolsrc/include/PackageSpec.h +++ b/toolsrc/include/PackageSpec.h @@ -6,6 +6,15 @@ namespace vcpkg { + struct ParsedSpecifier + { + std::string name; + std::vector features; + std::string triplet; + + static ExpectedT from_string(const std::string& input); + }; + struct PackageSpec { static std::string to_string(const std::string& name, const Triplet& triplet); diff --git a/toolsrc/include/vcpkg_Checks.h b/toolsrc/include/vcpkg_Checks.h index 6d8ff5711..754b44f75 100644 --- a/toolsrc/include/vcpkg_Checks.h +++ b/toolsrc/include/vcpkg_Checks.h @@ -5,18 +5,23 @@ namespace vcpkg::Checks { + // Indicate that an internal error has occurred and exit the tool. This should be used when invariants have been + // broken. [[noreturn]] void unreachable(const LineInfo& line_info); [[noreturn]] void exit_with_code(const LineInfo& line_info, const int exit_code); + // Exit the tool without an error message. [[noreturn]] inline void exit_fail(const LineInfo& line_info) { exit_with_code(line_info, EXIT_FAILURE); } + // Exit the tool successfully. [[noreturn]] inline void exit_success(const LineInfo& line_info) { exit_with_code(line_info, EXIT_SUCCESS); } - // Part of the reason these exist is to not include extra headers in this one to avoid circular #includes. + // Display an error message to the user and exit the tool. [[noreturn]] void exit_with_message(const LineInfo& line_info, const CStringView errorMessage); template + // Display an error message to the user and exit the tool. [[noreturn]] void exit_with_message(const LineInfo& line_info, const char* errorMessageTemplate, const Arg1 errorMessageArg1, -- cgit v1.2.3