diff --git a/src/lib/diff/gen-node.hpp b/src/lib/diff/gen-node.hpp index 8daca99eb..6fd239cad 100644 --- a/src/lib/diff/gen-node.hpp +++ b/src/lib/diff/gen-node.hpp @@ -281,32 +281,16 @@ namespace diff{ template<> inline GenNode&& - Rec::Mutator::genNode() + MakeRec::genNode() { - UNIMPLEMENTED("wrap newly built Record into a new GenNode instance"); + return std::move (GenNode(std::move(record_))); } template<> inline GenNode&& - Rec::Mutator::genNode(string const& symbolicID) + MakeRec::genNode(string const& symbolicID) { - UNIMPLEMENTED("wrap newly built Record into a new named GenNode instance"); - } - - template<> - template - inline Rec::Mutator& - Rec::Mutator::attrib (ARGS&& ...args) - { - UNIMPLEMENTED("split sequence of arguments into key-value pairs and use these to populate the attributes collection"); - } - - template<> - template - inline Rec::Mutator& - Rec::Mutator::scope (ARGS&& ...args) - { - UNIMPLEMENTED("split sequence of arguments and build GenNode instances from them, to populate scope collection"); + return std::move (GenNode(symbolicID, std::move(record_))); } diff --git a/src/lib/diff/record.hpp b/src/lib/diff/record.hpp index b9faa6e47..2e1fe7714 100644 --- a/src/lib/diff/record.hpp +++ b/src/lib/diff/record.hpp @@ -413,11 +413,34 @@ namespace diff{ VAL&& genNode(); VAL&& genNode(string const& symbolicID); - template - Mutator& attrib (ARGS&& ...); + template + Mutator& attrib (string const& key, X const& initialiser, ARGS&& ...args) + { + set (key, VAL(initialiser)); + return attrib (std::forward(args)...); + } + + template + Mutator& + attrib (string const& key, X const& initialiser) + { + set (key, VAL(initialiser)); + return *this; + } - template - Mutator& scope (ARGS&& ...); + template + Mutator& scope (X const& initialiser, ARGS&& ...args) + { + appendChild (VAL(initialiser)); + return scope (std::forward(args)...); + } + + template + Mutator& scope (X const& initialiser) + { + appendChild (VAL(initialiser)); + return *this; + } };