int main(int argc, char **argv)
{
- vector<Directive *> things;
+ Substitute master_directive = {
+ make_pair("color", new Replace("blue")),
+ make_pair("#things", new Clone {
+ new Substitute { make_pair("li", new Replace("Raindrops on roses")) },
+ new Substitute { make_pair("li", new Replace("Whiskers on kittens")) },
+ new Substitute { make_pair("li", new Replace("Bright copper kettles")) },
+ new Substitute { make_pair("li", new Replace("Warm, woolen mittens")) },
+ }),
+ };
- {
- unordered_map<string, Directive *> submap;
- submap.insert(make_pair("li", new Replace("Raindrops on roses")));
- things.push_back(new Substitute(submap));
- }
- {
- unordered_map<string, Directive *> submap;
- submap.insert(make_pair("li", new Replace("Whiskers on kittens")));
- things.push_back(new Substitute(submap));
- }
- {
- unordered_map<string, Directive *> submap;
- submap.insert(make_pair("li", new Replace("Bright copper kettles")));
- things.push_back(new Substitute(submap));
- }
- {
- unordered_map<string, Directive *> submap;
- submap.insert(make_pair("li", new Replace("Warm, woolen mittens")));
- things.push_back(new Substitute(submap));
- }
-
- unordered_map<string, Directive *> master_map;
- master_map.insert(make_pair("color", new Replace("blue")));
- master_map.insert(make_pair("#things", new Clone(things)));
-
- process_file("../xml/clone.xml", argv[1], new Substitute(master_map));
+ process_file("../xml/clone.xml", argv[1], &master_directive);
return(0);
}