-
Notifications
You must be signed in to change notification settings - Fork 295
/
Copy pathparagraphs.h
69 lines (53 loc) · 3.28 KB
/
paragraphs.h
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#pragma once
#include <vcpkg/base/fwd/expected.h>
#include <vcpkg/base/fwd/stringview.h>
#include <vcpkg/fwd/binaryparagraph.h>
#include <vcpkg/fwd/paragraphparser.h>
#include <vcpkg/fwd/registries.h>
#include <vcpkg/sourceparagraph.h>
#include <string>
#include <utility>
#include <vector>
namespace vcpkg::Paragraphs
{
uint64_t get_load_ports_stats();
ExpectedL<Paragraph> parse_single_merged_paragraph(StringView str, StringView origin);
ExpectedL<Paragraph> parse_single_paragraph(StringView str, StringView origin);
ExpectedL<Paragraph> get_single_paragraph(const ReadOnlyFilesystem& fs, const Path& control_path);
ExpectedL<std::vector<Paragraph>> get_paragraphs(const ReadOnlyFilesystem& fs, const Path& control_path);
ExpectedL<std::vector<Paragraph>> parse_paragraphs(StringView str, StringView origin);
void append_paragraph_field(StringView name, StringView field, std::string& out_str);
bool is_port_directory(const ReadOnlyFilesystem& fs, const Path& maybe_directory);
struct PortLoadResult
{
ExpectedL<SourceControlFileAndLocation> maybe_scfl;
std::string on_disk_contents;
};
// If an error occurs, the Expected will be in the error state.
// Otherwise, if the port is known, the maybe_scfl.get()->source_control_file contains the loaded port information.
// Otherwise, maybe_scfl.get()->source_control_file is nullptr.
PortLoadResult try_load_port(const ReadOnlyFilesystem& fs, const PortLocation& port_location);
// Identical to try_load_port, but the port unknown condition is mapped to an error.
PortLoadResult try_load_port_required(const ReadOnlyFilesystem& fs,
StringView port_name,
const PortLocation& port_location);
ExpectedL<std::unique_ptr<SourceControlFile>> try_load_project_manifest_text(StringView text,
StringView control_path,
MessageSink& warning_sink);
ExpectedL<std::unique_ptr<SourceControlFile>> try_load_port_manifest_text(StringView text,
StringView control_path,
MessageSink& warning_sink);
ExpectedL<std::unique_ptr<SourceControlFile>> try_load_control_file_text(StringView text, StringView control_path);
ExpectedL<BinaryControlFile> try_load_cached_package(const ReadOnlyFilesystem& fs,
const Path& package_dir,
const PackageSpec& spec);
struct LoadResults
{
std::vector<SourceControlFileAndLocation> paragraphs;
std::vector<std::pair<std::string, LocalizedString>> errors;
};
LoadResults try_load_all_registry_ports(const RegistrySet& registries);
std::vector<SourceControlFileAndLocation> load_all_registry_ports(const RegistrySet& registries);
LoadResults try_load_overlay_ports(const ReadOnlyFilesystem& fs, const Path& dir);
std::vector<SourceControlFileAndLocation> load_overlay_ports(const ReadOnlyFilesystem& fs, const Path& dir);
}