1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: libxmlutil.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_jvmfwk.hxx"
33 #include "libxmlutil.hxx"
38 CXPathObjectPtr::CXPathObjectPtr(xmlXPathObject
* aObject
)
43 CXPathObjectPtr::CXPathObjectPtr():_object(NULL
)
47 CXPathObjectPtr::~CXPathObjectPtr()
49 xmlXPathFreeObject(_object
);
51 CXPathObjectPtr
& CXPathObjectPtr::operator = (xmlXPathObject
* pObj
)
56 xmlXPathFreeObject(_object
);
60 xmlXPathObject
* CXPathObjectPtr::operator ->()
65 CXPathObjectPtr::operator xmlXPathObject
*()
69 //===========================================================
70 CXPathContextPtr::CXPathContextPtr(xmlXPathContextPtr aContext
)
75 CXPathContextPtr::CXPathContextPtr():_object(NULL
)
79 CXPathContextPtr::~CXPathContextPtr()
81 xmlXPathFreeContext(_object
);
84 CXPathContextPtr
& CXPathContextPtr::operator = (xmlXPathContextPtr pObj
)
88 xmlXPathFreeContext(_object
);
92 xmlXPathContext
* CXPathContextPtr::operator ->()
97 CXPathContextPtr::operator xmlXPathContext
*()
101 //===========================================================
102 CXmlDocPtr::CXmlDocPtr(xmlDoc
* aDoc
)
107 CXmlDocPtr::CXmlDocPtr():_object(NULL
)
111 CXmlDocPtr::~CXmlDocPtr()
115 CXmlDocPtr
& CXmlDocPtr::operator = (xmlDoc
* pObj
)
124 xmlDoc
* CXmlDocPtr::operator ->()
129 CXmlDocPtr::operator xmlDoc
*()
134 //===========================================================
135 CXmlCharPtr::CXmlCharPtr(xmlChar
* aChar
)
140 CXmlCharPtr::CXmlCharPtr(const ::rtl::OUString
& s
):
143 ::rtl::OString o
= ::rtl::OUStringToOString(s
, RTL_TEXTENCODING_UTF8
);
144 _object
= xmlCharStrdup(o
.getStr());
146 CXmlCharPtr::CXmlCharPtr():_object(NULL
)
150 CXmlCharPtr::~CXmlCharPtr()
155 CXmlCharPtr
& CXmlCharPtr::operator = (xmlChar
* pObj
)
164 CXmlCharPtr::operator xmlChar
*()
169 CXmlCharPtr::operator ::rtl::OUString()
174 ::rtl::OString
aOStr((sal_Char
*)_object
);
175 ret
= ::rtl::OStringToOUString(aOStr
, RTL_TEXTENCODING_UTF8
);
180 CXmlCharPtr::operator ::rtl::OString()
182 return ::rtl::OString((sal_Char
*) _object
);