diff options
Diffstat (limited to 'project2/xml/mutators/rename.cpp')
-rw-r--r-- | project2/xml/mutators/rename.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/project2/xml/mutators/rename.cpp b/project2/xml/mutators/rename.cpp new file mode 100644 index 0000000..ceb7627 --- /dev/null +++ b/project2/xml/mutators/rename.cpp @@ -0,0 +1,25 @@ +#include "../pch.hpp" +#include "../xmlPresenter.h" + +class Rename : public XmlDocMutator { + public: + Rename(ScriptNodePtr s) : + XmlDocMutator(s), + xpath(s, "xpath"), + newname(s, "newname") + { + } + void mutateElement(xmlpp::Element * root) const + { + BOOST_FOREACH(xmlpp::Node * e, root->find(xpath())) { + e->set_name(newname()); + } + } + Variable xpath; + Variable newname; +}; + +DECLARE_GENERIC_LOADER("rename", XmlDocMutatorLoader, Rename); + + + |