fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / jvmfwk / source / libxmlutil.cxx
blob35177e002ddb35cd8702fb40e26a3ca8e58e2024
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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"
22 namespace jfw
25 CXPathObjectPtr::CXPathObjectPtr():_object(NULL)
29 CXPathObjectPtr::~CXPathObjectPtr()
31 xmlXPathFreeObject(_object);
33 CXPathObjectPtr & CXPathObjectPtr::operator = (xmlXPathObject* pObj)
35 if (_object == pObj)
36 return *this;
38 xmlXPathFreeObject(_object);
39 _object = pObj;
40 return *this;
43 CXPathContextPtr::CXPathContextPtr(xmlXPathContextPtr aContext)
44 : _object(aContext)
48 CXPathContextPtr::CXPathContextPtr():_object(NULL)
52 CXPathContextPtr::~CXPathContextPtr()
54 xmlXPathFreeContext(_object);
57 CXPathContextPtr & CXPathContextPtr::operator = (xmlXPathContextPtr pObj)
59 if (_object == pObj)
60 return *this;
61 xmlXPathFreeContext(_object);
62 _object = pObj;
63 return *this;
67 CXmlDocPtr::CXmlDocPtr(xmlDoc* aDoc)
68 : _object(aDoc)
72 CXmlDocPtr::CXmlDocPtr():_object(NULL)
76 CXmlDocPtr::~CXmlDocPtr()
78 xmlFreeDoc(_object);
80 CXmlDocPtr & CXmlDocPtr::operator = (xmlDoc* pObj)
82 if (_object == pObj)
83 return *this;
84 xmlFreeDoc(_object);
85 _object = pObj;
86 return *this;
92 CXmlCharPtr::CXmlCharPtr(xmlChar * aChar)
93 : _object(aChar)
97 CXmlCharPtr::CXmlCharPtr(const OUString & s):
98 _object(NULL)
100 OString o = OUStringToOString(s, RTL_TEXTENCODING_UTF8);
101 _object = xmlCharStrdup(o.getStr());
103 CXmlCharPtr::CXmlCharPtr():_object(NULL)
107 CXmlCharPtr::~CXmlCharPtr()
109 xmlFree(_object);
112 CXmlCharPtr & CXmlCharPtr::operator = (xmlChar* pObj)
114 if (pObj == _object)
115 return *this;
116 xmlFree(_object);
117 _object = pObj;
118 return *this;
122 CXmlCharPtr::operator OUString()
124 OUString ret;
125 if (_object != NULL)
127 OString aOStr(reinterpret_cast<char*>(_object));
128 ret = OStringToOUString(aOStr, RTL_TEXTENCODING_UTF8);
130 return ret;
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */