45 #include <libcxml/cxml.h>
54 optional_type_child (cxml::Node
const & node, std::string name)
56 auto n = node.node_children (name);
58 throw XMLError (
"duplicate XML tag");
59 }
else if (n.empty ()) {
63 return std::make_shared<T>(n.front());
68 std::shared_ptr<T> type_child (std::shared_ptr<const cxml::Node> node, std::string name) {
69 return std::make_shared<T>(node->node_child(name));
75 optional_type_child (std::shared_ptr<const cxml::Node> node, std::string name)
77 return optional_type_child<T> (*node.get(), name);
82 std::vector<std::shared_ptr<T>>
83 type_children (cxml::Node
const & node, std::string name)
85 std::vector<std::shared_ptr<T>> r;
86 for (
auto i: node.node_children(name)) {
87 r.push_back (std::make_shared<T>(i));
94 std::vector<std::shared_ptr<T>>
95 type_children (std::shared_ptr<const cxml::Node> node, std::string name)
97 return type_children<T> (*node.get(), name);
102 std::vector<std::shared_ptr<T>>
103 type_grand_children (cxml::Node
const & node, std::string name, std::string sub)
105 return type_children<T> (node.node_child(name), sub);
110 std::vector<std::shared_ptr<T>>
111 type_grand_children (std::shared_ptr<const cxml::Node> node, std::string name, std::string sub)
113 return type_grand_children<T> (*node.get(), name, sub);
Exceptions thrown by libdcp.
Namespace for everything in libdcp.