diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2018-12-17 18:47:07 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2019-01-08 16:24:46 +0300 |
commit | b2f240870b4f759a7cf6eaf4d4409d2f6b9af5e1 (patch) | |
tree | 7232967056b94cb3623eb80def4358bb61cc5d28 /libbpkg/manifest.hxx | |
parent | fbabb3ddf7f9bee71a6be767cc911b5b3b96333a (diff) |
Add package_manifest::load_files() function loading file-* values
Diffstat (limited to 'libbpkg/manifest.hxx')
-rw-r--r-- | libbpkg/manifest.hxx | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/libbpkg/manifest.hxx b/libbpkg/manifest.hxx index fc61511..3d8f5f5 100644 --- a/libbpkg/manifest.hxx +++ b/libbpkg/manifest.hxx @@ -9,10 +9,11 @@ #include <string> #include <vector> #include <cassert> -#include <cstdint> // uint16_t +#include <cstdint> // uint16_t #include <ostream> -#include <utility> // move() -#include <stdexcept> // logic_error +#include <utility> // move() +#include <stdexcept> // logic_error +#include <functional> #include <libbutl/url.mxx> #include <libbutl/path.mxx> @@ -634,6 +635,20 @@ namespace bpkg // void serialize_header (butl::manifest_serializer&) const; + + // Load the *-file manifest values using the specified load function that + // returns the file contents passing through any exception it may throw. + // + // Note that if the returned file contents is empty, load_files() makes + // sure that this is allowed by the value's semantics throwing + // manifest_parsing otherwise. However, the load function may want to + // recognize such cases itself in order to issue more precise diagnostics. + // + using load_function = std::string (const std::string& name, + const butl::path& value); + + void + load_files (const std::function<load_function>&); }; // Create individual package manifest. |