aboutsummaryrefslogtreecommitdiff
path: root/libbutl/manifest-rewriter.mxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2021-09-28 19:24:31 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2021-09-28 20:29:59 +0300
commitdf1ef68cd8e8582724ce1192bfc202e0b9aeaf0c (patch)
treeb731ca4c68e60c00c7e7d499dbf4868ee7b71f44 /libbutl/manifest-rewriter.mxx
parent7a4fc37f264cdb67f2f83fa92703c869215bbc86 (diff)
Get rid of C++ modules related code and rename *.mxx files to *.hxx
Diffstat (limited to 'libbutl/manifest-rewriter.mxx')
-rw-r--r--libbutl/manifest-rewriter.mxx78
1 files changed, 0 insertions, 78 deletions
diff --git a/libbutl/manifest-rewriter.mxx b/libbutl/manifest-rewriter.mxx
deleted file mode 100644
index 907c990..0000000
--- a/libbutl/manifest-rewriter.mxx
+++ /dev/null
@@ -1,78 +0,0 @@
-// file : libbutl/manifest-rewriter.mxx -*- C++ -*-
-// license : MIT; see accompanying LICENSE file
-
-#ifndef __cpp_modules_ts
-#pragma once
-#endif
-
-// C includes.
-
-#ifndef __cpp_lib_modules_ts
-#endif
-
-// Other includes.
-
-#ifdef __cpp_modules_ts
-export module butl.manifest_rewriter;
-#ifdef __cpp_lib_modules_ts
-#endif
-import butl.path;
-import butl.fdstream;
-import butl.manifest_types;
-#else
-#include <libbutl/path.mxx>
-#include <libbutl/fdstream.mxx>
-#include <libbutl/manifest-types.mxx>
-#endif
-
-#include <libbutl/export.hxx>
-
-LIBBUTL_MODEXPORT namespace butl
-{
- // Rewrite a hand-written manifest file preserving formatting, comments,
- // etc., of the unaffected parts. The general workflow is as follows:
- //
- // 1. Parse the manifest file using manifest_parser into a sequence of
- // name/value pairs and their positions.
- //
- // 2. Create an instance of manifest_rewriter for the manifest file. This
- // opens the file in read/write mode with exclusive access.
- //
- // 3. Iterate over this sequence in reverse and apply changes to the desired
- // name/value pairs using the below API. Doing this in reverse makes sure
- // the positions obtained on step 1 remain valid.
- //
- // Note that if an exception is thrown by replace() or insert(), then the
- // writer is no longer usable and there is no guarantees that the file is
- // left in a consistent state.
- //
- class LIBBUTL_SYMEXPORT manifest_rewriter
- {
- public:
- // Unless long_lines is true, break lines in values (see
- // manifest_serializer for details).
- //
- manifest_rewriter (path, bool long_lines = false);
-
- // Replace the existing value at the specified position (specifically,
- // between colon_pos and end_pos) with the specified new value. The new
- // value is serialized as if by manifest_serializer.
- //
- void
- replace (const manifest_name_value&);
-
- // Insert a new name/value after the specified position (specifically,
- // after end_pos). To insert before the first value, use the special
- // start-of-manifest value as position. The new name/value is serialized
- // as if by manifest_serializer. Throw manifest_serialization exception
- // on error.
- //
- void
- insert (const manifest_name_value& pos, const manifest_name_value&);
-
- private:
- path path_;
- bool long_lines_;
- auto_fd fd_;
- };
-}