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 604 : CXPathObjectPtr::CXPathObjectPtr():_object(NULL)
26 : {
27 604 : }
28 :
29 604 : CXPathObjectPtr::~CXPathObjectPtr()
30 : {
31 604 : xmlXPathFreeObject(_object);
32 604 : }
33 601 : CXPathObjectPtr & CXPathObjectPtr::operator = (xmlXPathObject* pObj)
34 : {
35 601 : if (_object == pObj)
36 0 : return *this;
37 :
38 601 : xmlXPathFreeObject(_object);
39 601 : _object = pObj;
40 601 : return *this;
41 : }
42 :
43 1 : CXPathContextPtr::CXPathContextPtr(xmlXPathContextPtr aContext)
44 1 : : _object(aContext)
45 : {
46 1 : }
47 :
48 158 : CXPathContextPtr::CXPathContextPtr():_object(NULL)
49 : {
50 158 : }
51 :
52 159 : CXPathContextPtr::~CXPathContextPtr()
53 : {
54 159 : xmlXPathFreeContext(_object);
55 159 : }
56 :
57 155 : CXPathContextPtr & CXPathContextPtr::operator = (xmlXPathContextPtr pObj)
58 : {
59 155 : if (_object == pObj)
60 0 : return *this;
61 155 : xmlXPathFreeContext(_object);
62 155 : _object = pObj;
63 155 : return *this;
64 : }
65 :
66 :
67 21 : CXmlDocPtr::CXmlDocPtr(xmlDoc* aDoc)
68 21 : : _object(aDoc)
69 : {
70 21 : }
71 :
72 158 : CXmlDocPtr::CXmlDocPtr():_object(NULL)
73 : {
74 158 : }
75 :
76 179 : CXmlDocPtr::~CXmlDocPtr()
77 : {
78 179 : xmlFreeDoc(_object);
79 179 : }
80 155 : CXmlDocPtr & CXmlDocPtr::operator = (xmlDoc* pObj)
81 : {
82 155 : if (_object == pObj)
83 0 : return *this;
84 155 : xmlFreeDoc(_object);
85 155 : _object = pObj;
86 155 : return *this;
87 : }
88 :
89 :
90 :
91 :
92 539 : CXmlCharPtr::CXmlCharPtr(xmlChar * aChar)
93 539 : : _object(aChar)
94 : {
95 539 : }
96 :
97 5 : CXmlCharPtr::CXmlCharPtr(const OUString & s):
98 5 : _object(NULL)
99 : {
100 5 : OString o = OUStringToOString(s, RTL_TEXTENCODING_UTF8);
101 5 : _object = xmlCharStrdup(o.getStr());
102 5 : }
103 192 : CXmlCharPtr::CXmlCharPtr():_object(NULL)
104 : {
105 192 : }
106 :
107 736 : CXmlCharPtr::~CXmlCharPtr()
108 : {
109 736 : xmlFree(_object);
110 736 : }
111 :
112 228 : CXmlCharPtr & CXmlCharPtr::operator = (xmlChar* pObj)
113 : {
114 228 : if (pObj == _object)
115 0 : return *this;
116 228 : xmlFree(_object);
117 228 : _object = pObj;
118 228 : return *this;
119 : }
120 :
121 :
122 544 : CXmlCharPtr::operator OUString()
123 : {
124 544 : OUString ret;
125 544 : if (_object != NULL)
126 : {
127 544 : OString aOStr(reinterpret_cast<char*>(_object));
128 544 : ret = OStringToOUString(aOStr, RTL_TEXTENCODING_UTF8);
129 : }
130 544 : return ret;
131 : }
132 :
133 :
134 :
135 :
136 : }
137 :
138 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|