LCOV - code coverage report
Current view: top level - jvmfwk/source - libxmlutil.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 60 83 72.3 %
Date: 2014-04-11 Functions: 19 26 73.1 %
Legend: Lines: hit not hit

          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          55 : CXPathObjectPtr::CXPathObjectPtr(xmlXPathObject* aObject)
      26          55 :     : _object(aObject)
      27             : {
      28          55 : }
      29             : 
      30         440 : CXPathObjectPtr::CXPathObjectPtr():_object(NULL)
      31             : {
      32         440 : }
      33             : 
      34         495 : CXPathObjectPtr::~CXPathObjectPtr()
      35             : {
      36         495 :     xmlXPathFreeObject(_object);
      37         495 : }
      38         436 : CXPathObjectPtr & CXPathObjectPtr::operator = (xmlXPathObject* pObj)
      39             : {
      40         436 :     if (_object == pObj)
      41           0 :         return *this;
      42             : 
      43         436 :     xmlXPathFreeObject(_object);
      44         436 :     _object = pObj;
      45         436 :     return *this;
      46             : }
      47        1414 : xmlXPathObject* CXPathObjectPtr::operator ->()
      48             : 
      49             : {
      50        1414 :     return _object;
      51             : }
      52           0 : CXPathObjectPtr::operator xmlXPathObject*() const
      53             : {
      54           0 :     return _object;
      55             : }
      56             : 
      57           0 : CXPathContextPtr::CXPathContextPtr(xmlXPathContextPtr aContext)
      58           0 :     : _object(aContext)
      59             : {
      60           0 : }
      61             : 
      62         114 : CXPathContextPtr::CXPathContextPtr():_object(NULL)
      63             : {
      64         114 : }
      65             : 
      66         114 : CXPathContextPtr::~CXPathContextPtr()
      67             : {
      68         114 :     xmlXPathFreeContext(_object);
      69         114 : }
      70             : 
      71         110 : CXPathContextPtr & CXPathContextPtr::operator = (xmlXPathContextPtr pObj)
      72             : {
      73         110 :     if (_object == pObj)
      74           0 :         return *this;
      75         110 :     xmlXPathFreeContext(_object);
      76         110 :     _object = pObj;
      77         110 :     return *this;
      78             : }
      79           0 : xmlXPathContext* CXPathContextPtr::operator ->()
      80             : {
      81           0 :     return _object;
      82             : }
      83             : 
      84         601 : CXPathContextPtr::operator xmlXPathContext*() const
      85             : {
      86         601 :     return _object;
      87             : }
      88             : 
      89           0 : CXmlDocPtr::CXmlDocPtr(xmlDoc* aDoc)
      90           0 :     : _object(aDoc)
      91             : {
      92           0 : }
      93             : 
      94         114 : CXmlDocPtr::CXmlDocPtr():_object(NULL)
      95             : {
      96         114 : }
      97             : 
      98         114 : CXmlDocPtr::~CXmlDocPtr()
      99             : {
     100         114 :     xmlFreeDoc(_object);
     101         114 : }
     102         110 : CXmlDocPtr & CXmlDocPtr::operator = (xmlDoc* pObj)
     103             : {
     104         110 :     if (_object == pObj)
     105           0 :         return *this;
     106         110 :     xmlFreeDoc(_object);
     107         110 :     _object = pObj;
     108         110 :     return *this;
     109             : }
     110             : 
     111           0 : xmlDoc* CXmlDocPtr::operator ->()
     112             : {
     113           0 :     return _object;
     114             : }
     115             : 
     116         715 : CXmlDocPtr::operator xmlDoc*() const
     117             : {
     118         715 :     return _object;
     119             : }
     120             : 
     121             : 
     122         966 : CXmlCharPtr::CXmlCharPtr(xmlChar * aChar)
     123         966 :     : _object(aChar)
     124             : {
     125         966 : }
     126             : 
     127           0 : CXmlCharPtr::CXmlCharPtr(const OUString & s):
     128           0 :     _object(NULL)
     129             : {
     130           0 :     OString o = OUStringToOString(s, RTL_TEXTENCODING_UTF8);
     131           0 :     _object = xmlCharStrdup(o.getStr());
     132           0 : }
     133         165 : CXmlCharPtr::CXmlCharPtr():_object(NULL)
     134             : {
     135         165 : }
     136             : 
     137        1131 : CXmlCharPtr::~CXmlCharPtr()
     138             : {
     139        1131 :     xmlFree(_object);
     140        1131 : }
     141             : 
     142         165 : CXmlCharPtr & CXmlCharPtr::operator = (xmlChar* pObj)
     143             : {
     144         165 :     if (pObj == _object)
     145           0 :         return *this;
     146         165 :     xmlFree(_object);
     147         165 :     _object = pObj;
     148         165 :     return *this;
     149             : }
     150             : 
     151         440 : CXmlCharPtr::operator xmlChar*() const
     152             : {
     153         440 :     return _object;
     154             : }
     155             : 
     156         691 : CXmlCharPtr::operator OUString()
     157             : {
     158         691 :     OUString ret;
     159         691 :     if (_object != NULL)
     160             :     {
     161         691 :         OString aOStr((sal_Char*)_object);
     162         691 :         ret = OStringToOUString(aOStr, RTL_TEXTENCODING_UTF8);
     163             :     }
     164         691 :     return ret;
     165             : }
     166             : 
     167           0 : CXmlCharPtr::operator OString()
     168             : {
     169           0 :     return OString((sal_Char*) _object);
     170             : }
     171             : 
     172             : 
     173             : 
     174             : }
     175             : 
     176             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10