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 .
20 #include <libxmlutil.hxx>
25 CXPathObjectPtr::CXPathObjectPtr():_object(nullptr)
28 CXPathObjectPtr::CXPathObjectPtr(xmlXPathObject
* pObj
):_object(pObj
)
31 CXPathObjectPtr::~CXPathObjectPtr()
33 xmlXPathFreeObject(_object
);
35 CXPathObjectPtr
& CXPathObjectPtr::operator = (xmlXPathObject
* pObj
)
40 xmlXPathFreeObject(_object
);
45 CXPathContextPtr::CXPathContextPtr(xmlXPathContextPtr aContext
)
50 CXPathContextPtr::CXPathContextPtr():_object(nullptr)
54 CXPathContextPtr::~CXPathContextPtr()
56 xmlXPathFreeContext(_object
);
59 CXPathContextPtr
& CXPathContextPtr::operator = (xmlXPathContextPtr pObj
)
63 xmlXPathFreeContext(_object
);
69 CXmlDocPtr::CXmlDocPtr(xmlDoc
* aDoc
)
74 CXmlDocPtr::CXmlDocPtr():_object(nullptr)
78 CXmlDocPtr::~CXmlDocPtr()
82 CXmlDocPtr
& CXmlDocPtr::operator = (xmlDoc
* pObj
)
92 CXmlCharPtr::CXmlCharPtr(xmlChar
* aChar
)
97 CXmlCharPtr::CXmlCharPtr(std::u16string_view s
):
100 OString o
= OUStringToOString(s
, RTL_TEXTENCODING_UTF8
);
101 _object
= xmlCharStrdup(o
.getStr());
103 CXmlCharPtr::CXmlCharPtr():_object(nullptr)
107 CXmlCharPtr::~CXmlCharPtr()
112 CXmlCharPtr
& CXmlCharPtr::operator = (xmlChar
* pObj
)
122 CXmlCharPtr::operator OUString()
125 if (_object
!= nullptr)
127 std::string_view
aOStr(reinterpret_cast<char*>(_object
));
128 ret
= OStringToOUString(aOStr
, RTL_TEXTENCODING_UTF8
);
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */