aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include/SourceParagraph.h
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-06-17 02:39:14 -0700
committerRobert Schumacher <roschuma@microsoft.com>2017-06-20 09:36:21 -0700
commit8741214bf69d1209a1e6d405ed8561d27f04436a (patch)
tree85325eb4b2d2c1c15eb8bd58426dac5462242d4e /toolsrc/include/SourceParagraph.h
parent8c4d55b8f304c74aeb95878cfe354830ff4abc88 (diff)
downloadvcpkg-8741214bf69d1209a1e6d405ed8561d27f04436a.tar.gz
vcpkg-8741214bf69d1209a1e6d405ed8561d27f04436a.zip
[vcpkg] Use unique_ptr<> for paragraphs. Post-parser phase rework.
Diffstat (limited to 'toolsrc/include/SourceParagraph.h')
-rw-r--r--toolsrc/include/SourceParagraph.h24
1 files changed, 7 insertions, 17 deletions
diff --git a/toolsrc/include/SourceParagraph.h b/toolsrc/include/SourceParagraph.h
index 31c9560cc..e85884b51 100644
--- a/toolsrc/include/SourceParagraph.h
+++ b/toolsrc/include/SourceParagraph.h
@@ -1,6 +1,7 @@
#pragma once
#include "Span.h"
+#include "vcpkg_Parse.h"
#include "vcpkg_System.h"
#include "vcpkg_expected.h"
@@ -22,13 +23,6 @@ namespace vcpkg
const std::string& to_string(const Dependency& dep);
- struct ParseControlErrorInfo
- {
- std::string name;
- std::string remaining_fields_as_string;
- std::error_code error;
- };
-
struct FeatureParagraph
{
std::string name;
@@ -47,23 +41,19 @@ namespace vcpkg
std::string maintainer;
std::vector<std::string> supports;
std::vector<Dependency> depends;
- std::string default_features;
+ std::vector<std::string> default_features;
};
struct SourceControlFile
{
- static ExpectedT<SourceControlFile, ParseControlErrorInfo> parse_control_file(
- std::vector<std::unordered_map<std::string, std::string>>&& control_paragraphs);
+ static Parse::ParseExpected<SourceControlFile> parse_control_file(
+ std::vector<Parse::RawParagraph>&& control_paragraphs);
- SourceParagraph core_paragraph;
+ std::unique_ptr<SourceParagraph> core_paragraph;
std::vector<std::unique_ptr<FeatureParagraph>> feature_paragraphs;
-
- std::vector<ParseControlErrorInfo> errors;
};
- std::vector<SourceParagraph> getSourceParagraphs(const std::vector<SourceControlFile>& control_files);
-
- void print_error_message(span<const ParseControlErrorInfo> error_info_list);
- inline void print_error_message(const ParseControlErrorInfo& error_info_list)
+ void print_error_message(span<const std::unique_ptr<Parse::ParseControlErrorInfo>> error_info_list);
+ inline void print_error_message(const std::unique_ptr<Parse::ParseControlErrorInfo>& error_info_list)
{
return print_error_message({&error_info_list, 1});
}