From 6254448640530240dc9199bed60cd5568cbaf601 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 1 Aug 2017 16:42:22 +0300 Subject: Add manifest_parser::split_comment() and manifest_serializer::merge_comment() --- libbutl/manifest-serializer.cxx | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'libbutl/manifest-serializer.cxx') diff --git a/libbutl/manifest-serializer.cxx b/libbutl/manifest-serializer.cxx index adb7f13..d8f640b 100644 --- a/libbutl/manifest-serializer.cxx +++ b/libbutl/manifest-serializer.cxx @@ -133,6 +133,31 @@ namespace butl os_ << endl; } + string manifest_serializer:: + merge_comment (const string& value, const string& comment) + { + string r; + for (char c: value) + { + // Escape ';' character. + // + if (c == ';') + r += '\\'; + + r += c; + } + + // Add the comment. + // + if (!comment.empty ()) + { + r += "; "; + r += comment; + } + + return r; + } + void manifest_serializer:: check_name (const string& n) { -- cgit v1.1