Line data Source code
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 :
22 : namespace jfw
23 : {
24 :
25 0 : CXPathObjectPtr::CXPathObjectPtr(xmlXPathObject* aObject)
26 0 : : _object(aObject)
27 : {
28 0 : }
29 :
30 828 : CXPathObjectPtr::CXPathObjectPtr():_object(NULL)
31 : {
32 828 : }
33 :
34 828 : CXPathObjectPtr::~CXPathObjectPtr()
35 : {
36 828 : xmlXPathFreeObject(_object);
37 828 : }
38 816 : CXPathObjectPtr & CXPathObjectPtr::operator = (xmlXPathObject* pObj)
39 : {
40 816 : if (_object == pObj)
41 0 : return *this;
42 :
43 816 : xmlXPathFreeObject(_object);
44 816 : _object = pObj;
45 816 : return *this;
46 : }
47 :
48 2 : CXPathContextPtr::CXPathContextPtr(xmlXPathContextPtr aContext)
49 2 : : _object(aContext)
50 : {
51 2 : }
52 :
53 246 : CXPathContextPtr::CXPathContextPtr():_object(NULL)
54 : {
55 246 : }
56 :
57 248 : CXPathContextPtr::~CXPathContextPtr()
58 : {
59 248 : xmlXPathFreeContext(_object);
60 248 : }
61 :
62 234 : CXPathContextPtr & CXPathContextPtr::operator = (xmlXPathContextPtr pObj)
63 : {
64 234 : if (_object == pObj)
65 0 : return *this;
66 234 : xmlXPathFreeContext(_object);
67 234 : _object = pObj;
68 234 : return *this;
69 : }
70 :
71 :
72 42 : CXmlDocPtr::CXmlDocPtr(xmlDoc* aDoc)
73 42 : : _object(aDoc)
74 : {
75 42 : }
76 :
77 246 : CXmlDocPtr::CXmlDocPtr():_object(NULL)
78 : {
79 246 : }
80 :
81 288 : CXmlDocPtr::~CXmlDocPtr()
82 : {
83 288 : xmlFreeDoc(_object);
84 288 : }
85 234 : CXmlDocPtr & CXmlDocPtr::operator = (xmlDoc* pObj)
86 : {
87 234 : if (_object == pObj)
88 0 : return *this;
89 234 : xmlFreeDoc(_object);
90 234 : _object = pObj;
91 234 : return *this;
92 : }
93 :
94 :
95 :
96 :
97 696 : CXmlCharPtr::CXmlCharPtr(xmlChar * aChar)
98 696 : : _object(aChar)
99 : {
100 696 : }
101 :
102 10 : CXmlCharPtr::CXmlCharPtr(const OUString & s):
103 10 : _object(NULL)
104 : {
105 10 : OString o = OUStringToOString(s, RTL_TEXTENCODING_UTF8);
106 10 : _object = xmlCharStrdup(o.getStr());
107 10 : }
108 394 : CXmlCharPtr::CXmlCharPtr():_object(NULL)
109 : {
110 394 : }
111 :
112 1100 : CXmlCharPtr::~CXmlCharPtr()
113 : {
114 1100 : xmlFree(_object);
115 1100 : }
116 :
117 466 : CXmlCharPtr & CXmlCharPtr::operator = (xmlChar* pObj)
118 : {
119 466 : if (pObj == _object)
120 0 : return *this;
121 466 : xmlFree(_object);
122 466 : _object = pObj;
123 466 : return *this;
124 : }
125 :
126 :
127 776 : CXmlCharPtr::operator OUString()
128 : {
129 776 : OUString ret;
130 776 : if (_object != NULL)
131 : {
132 776 : OString aOStr((sal_Char*)_object);
133 776 : ret = OStringToOUString(aOStr, RTL_TEXTENCODING_UTF8);
134 : }
135 776 : return ret;
136 : }
137 :
138 :
139 :
140 :
141 : }
142 :
143 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|