diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2017-08-18 20:32:35 -0700 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2017-08-18 20:32:35 -0700 |
| commit | 4d34488649fe5d71b8a553706d960a3784c56bb1 (patch) | |
| tree | 732e382d5b84bb626b1bc0eaec008592d5ed9112 /toolsrc/include | |
| parent | aab0173509c89746f8988b000854d2ed8c9115e7 (diff) | |
| download | vcpkg-4d34488649fe5d71b8a553706d960a3784c56bb1.tar.gz vcpkg-4d34488649fe5d71b8a553706d960a3784c56bb1.zip | |
[vcpkg] Consolidate specifier parsing
Diffstat (limited to 'toolsrc/include')
| -rw-r--r-- | toolsrc/include/PackageSpec.h | 9 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Checks.h | 7 |
2 files changed, 15 insertions, 1 deletions
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<std::string> features; + std::string triplet; + + static ExpectedT<ParsedSpecifier, PackageSpecParseResult> 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<class Arg1, class... Args> + // 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, |
