blob: 34d2a8170705525f909ec8009624225d72fc6346 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#include "SourceParagraph.h"
#include "vcpkglib_helpers.h"
namespace vcpkg
{
//
namespace SourceParagraphRequiredField
{
static const std::string SOURCE = "Source";
static const std::string VERSION = "Version";
}
namespace SourceParagraphOptionalField
{
static const std::string DESCRIPTION = "Description";
static const std::string MAINTAINER = "Maintainer";
static const std::string BUILD_DEPENDS = "Build-Depends";
}
const std::vector<std::string>& SourceParagraph::get_list_of_valid_fields()
{
static const std::vector<std::string> valid_fields =
{
SourceParagraphRequiredField::SOURCE,
SourceParagraphRequiredField::VERSION,
SourceParagraphOptionalField::DESCRIPTION,
SourceParagraphOptionalField::MAINTAINER,
SourceParagraphOptionalField::BUILD_DEPENDS
};
return valid_fields;
}
SourceParagraph::SourceParagraph() = default;
SourceParagraph::SourceParagraph(std::unordered_map<std::string, std::string> fields)
{
using namespace vcpkg::details;
this->name = remove_required_field(&fields, SourceParagraphRequiredField::SOURCE);
this->version = remove_required_field(&fields, SourceParagraphRequiredField::VERSION);
this->description = remove_optional_field(&fields, SourceParagraphOptionalField::DESCRIPTION);
this->maintainer = remove_optional_field(&fields, SourceParagraphOptionalField::MAINTAINER);
std::string deps = remove_optional_field(&fields, SourceParagraphOptionalField::BUILD_DEPENDS);
this->depends = parse_depends(deps);
this->unparsed_fields = std::move(fields);
}
}
|