2 #include <libxml/xpath.h>
19 qDebug() <<
"[Memory] ~SVGPPDoc(" <<
this <<
")";
24 xmlNodePtr
root() {
return xmlDocGetRootElement(
xml_); }
27 std::string query = QString(
"//*[@id='" + QString::fromStdString(
id) +
"']").toStdString();
28 xmlXPathObjectPtr result = xmlXPathEval(
29 (
const xmlChar *) query.c_str(),
31 if (result ==
nullptr || result->nodesetval ==
nullptr)
return nullptr;
33 for (
int i = 0; i < result->nodesetval->nodeNr; i++) {
34 xmlNodePtr node = result->nodesetval->nodeTab[i];
35 if (node->type == XML_ELEMENT_NODE) {
52 std::pair<SVGPPDoc::followed_refs_t::iterator, bool> ins = svgpp_doc.
followed_refs_.insert(el);
54 throw std::runtime_error(
"Cyclic reference found");
62 SVGPPDoc::followed_refs_t::iterator lock_;
Definition: svgpp-doc.h:49
FollowRef(SVGPPDoc &svgpp_doc, xmlNodePtr el)
Definition: svgpp-doc.h:51
~FollowRef()
Definition: svgpp-doc.h:58
Definition: svgpp-doc.h:10
followed_refs_t followed_refs_
Definition: svgpp-doc.h:46
SVGPPDoc(xmlDocPtr xml_doc)
Definition: svgpp-doc.h:14
xmlNodePtr getElementById(std::string id)
Definition: svgpp-doc.h:26
xmlDocPtr xml_
Definition: svgpp-doc.h:43
xmlXPathContextPtr xml_context_
Definition: svgpp-doc.h:44
xmlNodePtr root()
Definition: svgpp-doc.h:24
std::set< xmlNodePtr > followed_refs_t
Definition: svgpp-doc.h:45
~SVGPPDoc()
Definition: svgpp-doc.h:18
Definition: base-context.h:8