From bf3d969ef2dbc615bd528f559920bcf532dda910 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 15 Dec 2018 14:45:24 +0200 Subject: Implement bdep-release that manages project's version during release --- bdep/utility.txx | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'bdep/utility.txx') diff --git a/bdep/utility.txx b/bdep/utility.txx index 9926e12..cab2dd8 100644 --- a/bdep/utility.txx +++ b/bdep/utility.txx @@ -4,9 +4,6 @@ #include // cin -#include -#include - #include namespace bdep @@ -236,7 +233,10 @@ namespace bdep // template T - parse_manifest (const path& f, const char* what, bool iu) + parse_manifest (const path& f, + const char* what, + bool iu, + function ff) { using namespace butl; @@ -249,7 +249,7 @@ namespace bdep fail << what << " manifest file " << f << " does not exist"; ifdstream ifs (f); - return parse_manifest (ifs, f.string (), what, iu); + return parse_manifest (ifs, f.string (), what, iu, move (ff)); } catch (const system_error& e) // EACCES, etc. { @@ -260,13 +260,17 @@ namespace bdep template T - parse_manifest (istream& is, const string& name, const char* what, bool iu) + parse_manifest (istream& is, + const string& name, + const char* what, + bool iu, + function ff) { using namespace butl; try { - manifest_parser p (is, name); + manifest_parser p (is, name, move (ff)); return T (p, iu); } catch (const manifest_parsing& e) @@ -283,7 +287,10 @@ namespace bdep template void - serialize_manifest (const T& m, const path& f, const char* what) + serialize_manifest (const T& m, + const path& f, + const char* what, + function ff) { using namespace std; using namespace butl; @@ -293,7 +300,7 @@ namespace bdep ofdstream ofs (f, ios::binary); auto_rmfile arm (f); // Try to remove on failure ignoring errors. - serialize_manifest (m, ofs, f.string (), what); + serialize_manifest (m, ofs, f.string (), what, move (ff)); ofs.close (); arm.cancel (); @@ -309,13 +316,14 @@ namespace bdep serialize_manifest (const T& m, ostream& os, const string& name, - const char* what) + const char* what, + function ff) { using namespace butl; try { - manifest_serializer s (os, name); + manifest_serializer s (os, name, move (ff)); m.serialize (s); return; } -- cgit v1.1