GME  13
xml_smart_ptr.h
Go to the documentation of this file.
00001 #include <xercesc/dom/dom.hpp>
00002 #include <string>
00003 
00004 template <class X>
00005 class xml_smart_ptr
00006 {
00007 private:
00008         X* p;
00009 public:
00010         xml_smart_ptr(X* p=0) : p(p) {}
00011         ~xml_smart_ptr() { XERCES_CPP_NAMESPACE::XMLString::release(&p); }
00012         operator X*() const { return p; }
00013 private: // noncopyable
00014         xml_smart_ptr(const xml_smart_ptr<X>&);
00015         const xml_smart_ptr<X>& operator=(const xml_smart_ptr<X>&);
00016 };
00017 typedef xml_smart_ptr<XMLCh> smart_XMLCh;
00018 typedef xml_smart_ptr<char> smart_Ch;
00019 
00020 static std::string operator+(const std::string& left, const smart_Ch& right) {
00021         return left + static_cast<const char*>(right);
00022 }