WIP: implement the node builder API

This commit is contained in:
Fischlurch 2015-07-04 15:22:04 +02:00
parent d14c502ea9
commit ee6d044e33
2 changed files with 31 additions and 24 deletions

View file

@ -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<typename...ARGS>
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<typename...ARGS>
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_)));
}

View file

@ -413,11 +413,34 @@ namespace diff{
VAL&& genNode();
VAL&& genNode(string const& symbolicID);
template<typename...ARGS>
Mutator& attrib (ARGS&& ...);
template<typename X, typename...ARGS>
Mutator& attrib (string const& key, X const& initialiser, ARGS&& ...args)
{
set (key, VAL(initialiser));
return attrib (std::forward<ARGS>(args)...);
}
template<typename X>
Mutator&
attrib (string const& key, X const& initialiser)
{
set (key, VAL(initialiser));
return *this;
}
template<typename...ARGS>
Mutator& scope (ARGS&& ...);
template<typename X, typename...ARGS>
Mutator& scope (X const& initialiser, ARGS&& ...args)
{
appendChild (VAL(initialiser));
return scope (std::forward<ARGS>(args)...);
}
template<typename X>
Mutator& scope (X const& initialiser)
{
appendChild (VAL(initialiser));
return *this;
}
};