1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_JVMFWK_INC_LIBXMLUTIL_HXX
20 #define INCLUDED_JVMFWK_INC_LIBXMLUTIL_HXX
22 #include <sal/config.h>
24 #include <string_view>
26 #include <libxml/parser.h>
27 #include <libxml/xpath.h>
28 #include <rtl/ustring.hxx>
34 xmlXPathObject
* _object
;
35 CXPathObjectPtr
& operator=(const CXPathObjectPtr
&) = delete;
36 CXPathObjectPtr(const CXPathObjectPtr
&) = delete;
40 CXPathObjectPtr(xmlXPathObject
*);
42 /** Takes ownership of xmlXPathObject
44 CXPathObjectPtr
& operator=(xmlXPathObject
* pObj
);
45 xmlXPathObject
* operator->() { return _object
; }
46 operator xmlXPathObject
*() const { return _object
; }
49 class CXPathContextPtr
51 xmlXPathContext
* _object
;
53 CXPathContextPtr(const jfw::CXPathContextPtr
&) = delete;
54 CXPathContextPtr
& operator=(const CXPathContextPtr
&) = delete;
58 CXPathContextPtr(xmlXPathContextPtr aContext
);
59 CXPathContextPtr
& operator=(xmlXPathContextPtr pObj
);
61 operator xmlXPathContext
*() const { return _object
; }
68 CXmlDocPtr(const CXmlDocPtr
&) = delete;
71 CXmlDocPtr
& operator=(const CXmlDocPtr
&);
73 CXmlDocPtr(xmlDoc
* aDoc
);
74 /** Takes ownership of xmlDoc
76 CXmlDocPtr
& operator=(xmlDoc
* pObj
);
78 operator xmlDoc
*() const { return _object
; }
85 CXmlCharPtr(const CXmlCharPtr
&) = delete;
86 CXmlCharPtr
& operator=(const CXmlCharPtr
&) = delete;
90 CXmlCharPtr(xmlChar
* aDoc
);
91 explicit CXmlCharPtr(std::u16string_view
);
93 CXmlCharPtr
& operator=(xmlChar
* pObj
);
94 operator xmlChar
*() const { return _object
; }
96 operator OString() { return reinterpret_cast<char*>(_object
); }
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */