aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/xml/document/libxml-guards.h
blob: 619ca23ce7fbb917eb333c424cb7c90812c8a1b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once

#include <library/cpp/xml/init/ptr.h>
#include <util/generic/ptr.h>
#include <libxml/xmlstring.h> 
#include <libxml/tree.h> 
#include <libxml/xpath.h> 
#include <libxml/uri.h> 
#include <libxml/xmlsave.h>

namespace NXml {
    namespace NDetail {
        struct TSignedCharPtrTraits {
            static void Destroy(char* handle) {
                xmlFree(handle);
            }
        };

        struct TCharPtrTraits {
            static void Destroy(xmlChar* handle) {
                xmlFree(handle);
            }
        };

        struct TOutputBufferPtrTraits {
            static void Destroy(xmlOutputBufferPtr handle) {
                xmlOutputBufferClose(handle);
            }
        };

        struct TSaveCtxtPtrTraits {
            static void Destroy(xmlSaveCtxtPtr handle) {
                xmlSaveClose(handle);
            }
        };

    }

    typedef TxmlXPathContextPtr TXPathContextPtr; 
    typedef TxmlXPathObjectPtr TXPathObjectPtr; 
    typedef TAutoPtr<char, NDetail::TSignedCharPtrTraits> TSignedCharPtr;
    typedef TAutoPtr<xmlChar, NDetail::TCharPtrTraits> TCharPtr;
    typedef TxmlDocHolder TDocHolder;
    typedef TxmlURIPtr TURIPtr; 
    typedef TxmlNodePtr TNodePtr; 
    typedef TAutoPtr<xmlOutputBuffer, NDetail::TOutputBufferPtrTraits> TOutputBufferPtr;
    typedef TxmlParserCtxtPtr TParserCtxtPtr; 
    typedef TAutoPtr<xmlSaveCtxt, NDetail::TSaveCtxtPtrTraits> TSaveCtxtPtr;

}