diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-08-01 16:42:22 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-08-02 01:01:41 +0300 |
commit | 6254448640530240dc9199bed60cd5568cbaf601 (patch) | |
tree | 4f859f61f1980bde1027fd3e22573157e9b5bd4b /libbutl/manifest-serializer.cxx | |
parent | 12d0fb176edd8220f80f706d3fdc33431e178695 (diff) |
Add manifest_parser::split_comment() and manifest_serializer::merge_comment()
Diffstat (limited to 'libbutl/manifest-serializer.cxx')
-rw-r--r-- | libbutl/manifest-serializer.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
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) { |