aboutsummaryrefslogtreecommitdiff
path: root/bbot/utility
diff options
context:
space:
mode:
Diffstat (limited to 'bbot/utility')
-rw-r--r--bbot/utility53
1 files changed, 44 insertions, 9 deletions
diff --git a/bbot/utility b/bbot/utility
index 91bce64..59f6e09 100644
--- a/bbot/utility
+++ b/bbot/utility
@@ -13,7 +13,9 @@
#include <butl/ft/lang>
+#include <butl/curl>
#include <butl/process>
+#include <butl/process-io>
#include <butl/utility> // casecmp(), reverse_iterate(), etc
#include <butl/fdstream>
#include <butl/filesystem>
@@ -69,11 +71,11 @@ namespace bbot
template <typename I, typename O, typename E, typename P, typename... A>
void
- run_io (tracer&, I&& in, O&& out, E&& err, P&&, A&&...);
+ run_io (tracer&, I&& in, O&& out, E&& err, const P&, A&&...);
template <typename I, typename O, typename E, typename P, typename... A>
process_exit::code_type
- run_io_exit (tracer&, I&& in, O&& out, E&& err, P&&, A&&...);
+ run_io_exit (tracer&, I&& in, O&& out, E&& err, const P&, A&&...);
template <typename I, typename O, typename E, typename P, typename... A>
process
@@ -82,35 +84,61 @@ namespace bbot
O&& out,
E&& err,
const dir_path& cwd,
- P&&,
+ const P&,
A&&...);
template <typename P>
void
- run_io_finish (tracer&, process&, P&&);
+ run_io_finish (tracer&, process&, const P&);
template <typename P>
process_exit::code_type
- run_io_finish_exit (tracer&, process&, P&&);
+ run_io_finish_exit (tracer&, process&, const P&);
template <typename P, typename... A>
inline void
- run (tracer& t, P&& p, A&&... a)
+ run (tracer& t, const P& p, A&&... a)
{
- run_io (t, butl::fdnull (), 2, 2, forward<P> (p), forward<A> (a)...);
+ run_io (t, butl::fdnull (), 2, 2, p, forward<A> (a)...);
}
template <typename P, typename... A>
inline process_exit::code_type
- run_exit (tracer& t, P&& p, A&&... a)
+ run_exit (tracer& t, const P& p, A&&... a)
{
return run_io_exit (
- t, butl::fdnull (), 2, 2, forward<P> (p), forward<A> (a)...);
+ t, butl::fdnull (), 2, 2, p, forward<A> (a)...);
}
void
run_trace (tracer&, const char*[], size_t);
+ // The curl process wrapper (command line tracing, etc).
+ //
+ class http_curl: public butl::curl
+ {
+ public:
+ template <typename I, typename O, typename... A>
+ http_curl (tracer&,
+ I&& in,
+ O&& out,
+ method_type,
+ const string& url,
+ A&&... options);
+ };
+
+ class tftp_curl: public butl::curl
+ {
+ public:
+ template <typename I, typename O, typename... A>
+ tftp_curl (tracer&,
+ I&& in,
+ O&& out,
+ method_type,
+ const string& url,
+ A&&... options);
+ };
+
// Manifest parsing and serialization.
//
template <typename T>
@@ -118,6 +146,13 @@ namespace bbot
parse_manifest (const path&, const char* what, bool ignore_unknown = true);
template <typename T>
+ T
+ parse_manifest (istream&,
+ const string& name,
+ const char* what,
+ bool ignore_unknown = true);
+
+ template <typename T>
void
serialize_manifest (const T&, const path&, const char* what);