1 #ifndef xdoc_hh 2 #define xdoc_hh 3 4 #include <string> 5 #include <libxml/tree.h> 6 7 class XDoc 8 { 9 public: 10 XDoc(); 11 XDoc(xmlDocPtr doc); 12 XDoc(const XDoc &other); 13 ~XDoc(); 14 XDoc &operator=(const XDoc &other); 15 operator xmlDocPtr()16 operator xmlDocPtr() { return doc; } operator const xmlDocPtr() const17 operator const xmlDocPtr() const { return doc; } 18 19 xmlDocPtr yank(); 20 21 private: 22 xmlDocPtr doc; 23 int *ref_cnt; 24 add_ref() const25 void add_ref() const { ++*ref_cnt; } 26 void del_ref(); 27 }; 28 29 #endif 30