diff options
| author | Tobias Kohlbau <tobias@kohlbau.de> | 2017-03-28 10:48:26 +0200 |
|---|---|---|
| committer | Tobias Kohlbau <tobias@kohlbau.de> | 2017-03-28 10:51:53 +0200 |
| commit | a9aaead2d19c60a51edbaaddd97b745c51714220 (patch) | |
| tree | e0632fa068b11edd4be13e1ee191d65616a4cffb /toolsrc/include | |
| parent | 4fbcf0df4dd14176eda7d686bf122d0b65c0585a (diff) | |
| parent | a1cfa18481f9ea0f7eaaaeb34832d89c51f5f4f1 (diff) | |
| download | vcpkg-a9aaead2d19c60a51edbaaddd97b745c51714220.tar.gz vcpkg-a9aaead2d19c60a51edbaaddd97b745c51714220.zip | |
Merge branch 'master' of github.com:Microsoft/vcpkg into opencv_contrib
Diffstat (limited to 'toolsrc/include')
| -rw-r--r-- | toolsrc/include/Paragraphs.h | 6 | ||||
| -rw-r--r-- | toolsrc/include/paragraph_parse_result.h | 35 |
2 files changed, 39 insertions, 2 deletions
diff --git a/toolsrc/include/Paragraphs.h b/toolsrc/include/Paragraphs.h index 79b66a67f..74f8218ca 100644 --- a/toolsrc/include/Paragraphs.h +++ b/toolsrc/include/Paragraphs.h @@ -8,8 +8,10 @@ namespace vcpkg::Paragraphs { - std::vector<std::unordered_map<std::string, std::string>> get_paragraphs(const fs::path& control_path); - std::vector<std::unordered_map<std::string, std::string>> parse_paragraphs(const std::string& str); + expected<std::unordered_map<std::string, std::string>> get_single_paragraph(const fs::path& control_path); + expected<std::vector<std::unordered_map<std::string, std::string>>> get_paragraphs(const fs::path& control_path); + expected<std::unordered_map<std::string, std::string>> parse_single_paragraph(const std::string& str); + expected<std::vector<std::unordered_map<std::string, std::string>>> parse_paragraphs(const std::string& str); expected<SourceParagraph> try_load_port(const fs::path& control_path); diff --git a/toolsrc/include/paragraph_parse_result.h b/toolsrc/include/paragraph_parse_result.h new file mode 100644 index 000000000..47f20c08e --- /dev/null +++ b/toolsrc/include/paragraph_parse_result.h @@ -0,0 +1,35 @@ +#pragma once +#include <system_error> + +namespace vcpkg +{ + enum class paragraph_parse_result + { + SUCCESS = 0, + EXPECTED_ONE_PARAGRAPH + }; + + struct paragraph_parse_result_category_impl final : std::error_category + { + virtual const char* name() const noexcept override; + + virtual std::string message(int ev) const noexcept override; + }; + + const std::error_category& paragraph_parse_result_category(); + + std::error_code make_error_code(paragraph_parse_result e); + + paragraph_parse_result to_paragraph_parse_result(int i); + + paragraph_parse_result to_paragraph_parse_result(std::error_code ec); +} + +// Enable implicit conversion to std::error_code +namespace std +{ + template <> + struct is_error_code_enum<vcpkg::paragraph_parse_result> : ::std::true_type + { + }; +} |
