aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include/Paragraphs.h
blob: 26f81ffad9f960ca3edf640f47e69f416695a264 (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
#pragma once

#include "filesystem_fs.h"
#include <map>
#include "vcpkg_expected.h"
#include "BinaryParagraph.h"
#include "vcpkg_paths.h"
#include "version_t.h"

namespace vcpkg::Paragraphs
{
    using ParagraphDataMap = std::unordered_map<std::string, std::string>;

    expected<ParagraphDataMap> get_single_paragraph(const fs::path& control_path);
    expected<std::vector<ParagraphDataMap>> get_paragraphs(const fs::path& control_path);
    expected<ParagraphDataMap> parse_single_paragraph(const std::string& str);
    expected<std::vector<ParagraphDataMap>> parse_paragraphs(const std::string& str);

    expected<SourceParagraph> try_load_port(const fs::path& control_path);

    expected<BinaryParagraph> try_load_cached_package(const vcpkg_paths& paths, const package_spec& spec);

    std::vector<SourceParagraph> load_all_ports(const fs::path& ports_dir);

    std::map<std::string, version_t> extract_port_names_and_versions(const std::vector<SourceParagraph>& source_paragraphs);
}