LibreOffice Module jvmfwk (master) 1
libxmlutil.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <libxmlutil.hxx>
21
22namespace jfw
23{
24
26{
27}
28CXPathObjectPtr::CXPathObjectPtr(xmlXPathObject* pObj):_object(pObj)
29{
30}
32{
33 xmlXPathFreeObject(_object);
34}
36{
37 if (_object == pObj)
38 return *this;
39
40 xmlXPathFreeObject(_object);
41 _object = pObj;
42 return *this;
43}
44
45CXPathContextPtr::CXPathContextPtr(xmlXPathContextPtr aContext)
46 : _object(aContext)
47{
48}
49
51{
52}
53
55{
56 xmlXPathFreeContext(_object);
57}
58
60{
61 if (_object == pObj)
62 return *this;
63 xmlXPathFreeContext(_object);
64 _object = pObj;
65 return *this;
66}
67
68
70 : _object(aDoc)
71{
72}
73
74CXmlDocPtr::CXmlDocPtr():_object(nullptr)
75{
76}
77
79{
80 xmlFreeDoc(_object);
81}
83{
84 if (_object == pObj)
85 return *this;
86 xmlFreeDoc(_object);
87 _object = pObj;
88 return *this;
89}
90
91
93 : _object(aChar)
94{
95}
96
97CXmlCharPtr::CXmlCharPtr(std::u16string_view s):
98 _object(nullptr)
99{
100 OString o = OUStringToOString(s, RTL_TEXTENCODING_UTF8);
101 _object = xmlCharStrdup(o.getStr());
102}
103CXmlCharPtr::CXmlCharPtr():_object(nullptr)
104{
105}
106
108{
109 xmlFree(_object);
110}
111
113{
114 if (pObj == _object)
115 return *this;
116 xmlFree(_object);
117 _object = pObj;
118 return *this;
119}
120
121
122CXmlCharPtr::operator OUString()
123{
124 OUString ret;
125 if (_object != nullptr)
126 {
127 std::string_view aOStr(reinterpret_cast<char*>(_object));
128 ret = OStringToOUString(aOStr, RTL_TEXTENCODING_UTF8);
129 }
130 return ret;
131}
132
133
134}
135
136/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
CXPathContextPtr & operator=(const CXPathContextPtr &)=delete
xmlXPathContext * _object
Definition: libxmlutil.hxx:51
CXPathObjectPtr & operator=(const CXPathObjectPtr &)=delete
xmlXPathObject * _object
Definition: libxmlutil.hxx:34
CXmlCharPtr & operator=(const CXmlCharPtr &)=delete
xmlChar * _object
Definition: libxmlutil.hxx:83
CXmlDocPtr & operator=(const CXmlDocPtr &)
xmlDoc * _object
Definition: libxmlutil.hxx:66
Definition: elements.cxx:47
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)