From 0d5f29446b52bebeccfa2937b39493d015ff3456 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 12 Oct 2018 01:07:13 +0200 Subject: [PATCH] TreeMutator: provide no-op implementation how to further your career with eight simple steps --- src/lib/diff/tree-mutator-noop-binding.hpp | 30 +++++++++++++++++----- wiki/thinkPad.ichthyo.mm | 25 ++++++++++++------ 2 files changed, 40 insertions(+), 15 deletions(-) diff --git a/src/lib/diff/tree-mutator-noop-binding.hpp b/src/lib/diff/tree-mutator-noop-binding.hpp index a07c26fa3..c8fea45fb 100644 --- a/src/lib/diff/tree-mutator-noop-binding.hpp +++ b/src/lib/diff/tree-mutator-noop-binding.hpp @@ -70,18 +70,34 @@ namespace diff{ * Diff binding for black holes, happily accepting anything. * @note absorbs and silently ignores any diff verb. */ - template class BlackHoleMutation - : public PAR + : public TreeMutator { - public: - BlackHoleMutation (PAR&& chain) - : PAR{std::forward(chain)} - { } + BlackHoleMutation () = default; + /* ==== TreeMutator API ==== */ + + using Elm = GenNode const&; + using Buff = TreeMutator::Handle; + + bool hasSrc() override { return true; } ///< always keen to do yet more + + bool injectNew (Elm) override { return true; } ///< pretend to inject a new element + bool matchSrc (Elm) override { return true; } ///< purport suitable element is waiting + bool acceptSrc (Elm) override { return true; } ///< claim to handle any diff task + bool accept_until (Elm) override { return true; } ///< profess to forward anywhere + bool findSrc (Elm) override { return true; } ///< sham to find anything + bool assignElm (Elm) override { return true; } ///< accept any assignment + + bool + mutateChild (Elm, Buff buff) override ///< bluff to care for children, while just reproducing ourselves + { + buff.create (BlackHoleMutation()); + return true; + } }; @@ -91,7 +107,7 @@ namespace diff{ inline auto Builder::ignoreAllChanges() { - return chainedBuilder>(); + return Builder (BlackHoleMutation{}); } diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 8873e718f..9ca2edb50 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -16549,8 +16549,8 @@ - - + + @@ -16579,10 +16579,10 @@ - - - - + + + + @@ -16596,8 +16596,8 @@ - - + + @@ -16606,6 +16606,15 @@ + + + + + + + + +