summaryrefslogtreecommitdiff
path: root/project2/xml/mutators/create.cpp
blob: 812da24e73beaae13a6c48578a5ce48990dd2f13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "../pch.hpp"
#include "../xmlPresenter.h"

class Create : public XmlDocMutator {
	public:
		Create(ScriptNodePtr s) :
			XmlDocMutator(s),
			xpath(s, "xpath"),
			name(s, "name")
		{
		}
		void mutateElement(xmlpp::Element * root) const
		{
			BOOST_FOREACH(xmlpp::Node * e, root->find(xpath())) {
				e->add_child(name());
			}
		}
		Variable xpath;
		Variable name;
};

DECLARE_GENERIC_LOADER("create", XmlDocMutatorLoader, Create);