libxml-guards.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #pragma once
  2. #include <library/cpp/xml/init/ptr.h>
  3. #include <util/generic/ptr.h>
  4. #include <libxml/xmlstring.h>
  5. #include <libxml/tree.h>
  6. #include <libxml/xpath.h>
  7. #include <libxml/uri.h>
  8. #include <libxml/xmlsave.h>
  9. namespace NXml {
  10. namespace NDetail {
  11. struct TSignedCharPtrTraits {
  12. static void Destroy(char* handle) {
  13. xmlFree(handle);
  14. }
  15. };
  16. struct TCharPtrTraits {
  17. static void Destroy(xmlChar* handle) {
  18. xmlFree(handle);
  19. }
  20. };
  21. struct TOutputBufferPtrTraits {
  22. static void Destroy(xmlOutputBufferPtr handle) {
  23. xmlOutputBufferClose(handle);
  24. }
  25. };
  26. struct TSaveCtxtPtrTraits {
  27. static void Destroy(xmlSaveCtxtPtr handle) {
  28. xmlSaveClose(handle);
  29. }
  30. };
  31. }
  32. typedef TxmlXPathContextPtr TXPathContextPtr;
  33. typedef TxmlXPathObjectPtr TXPathObjectPtr;
  34. typedef TAutoPtr<char, NDetail::TSignedCharPtrTraits> TSignedCharPtr;
  35. typedef TAutoPtr<xmlChar, NDetail::TCharPtrTraits> TCharPtr;
  36. typedef TxmlDocHolder TDocHolder;
  37. typedef TxmlURIPtr TURIPtr;
  38. typedef TxmlNodePtr TNodePtr;
  39. typedef TAutoPtr<xmlOutputBuffer, NDetail::TOutputBufferPtrTraits> TOutputBufferPtr;
  40. typedef TxmlParserCtxtPtr TParserCtxtPtr;
  41. typedef TAutoPtr<xmlSaveCtxt, NDetail::TSaveCtxtPtrTraits> TSaveCtxtPtr;
  42. }