From 3bf1846063ad30ecc0fc90d34490bf70776faef0 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 15 Dec 2018 17:23:37 +0300 Subject: Add manifest_rewriter class --- libbutl/manifest-serializer.mxx | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'libbutl/manifest-serializer.mxx') diff --git a/libbutl/manifest-serializer.mxx b/libbutl/manifest-serializer.mxx index a1864d6..66ca398 100644 --- a/libbutl/manifest-serializer.mxx +++ b/libbutl/manifest-serializer.mxx @@ -75,15 +75,28 @@ LIBBUTL_MODEXPORT namespace butl merge_comment (const std::string& value, const std::string& comment); private: + friend class manifest_rewriter; + + // Validate and write a name. + // + void + write_name (const std::string&); + + // Write a value assuming the current line already has the specified + // offset. If the resulting line length would be too large then the + // multi-line representation will be used. It is assumed that the name, + // followed by the colon, is already written. + // void - check_name (const std::string&); + write_value (const std::string&, std::size_t offset); - // Write 'n' characters from 's' (assuming there are no newlines) - // split into multiple lines at or near the 78 characters - // boundary. The first line starts at the 'column' offset. + // Write the specified number of characters from the specified string + // (assuming there are no newlines) split into multiple lines at or near + // the 78 characters boundary. Assume the current line already has the + // specified offset. // void - write_value (std::size_t column, const char* s, std::size_t n); + write_value (const char* s, std::size_t n, std::size_t offset); private: enum {start, body, end} s_ = start; -- cgit v1.1