LCOV - code coverage report
Current view: top level - unoxml/source/dom - attr.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 40 40 100.0 %
Date: 2015-06-13 12:38:46 Functions: 21 21 100.0 %
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             : #ifndef INCLUDED_UNOXML_SOURCE_DOM_ATTR_HXX
      21             : #define INCLUDED_UNOXML_SOURCE_DOM_ATTR_HXX
      22             : 
      23             : #include <memory>
      24             : 
      25             : #include <libxml/tree.h>
      26             : 
      27             : #include <cppuhelper/implbase1.hxx>
      28             : 
      29             : #include <com/sun/star/uno/Reference.h>
      30             : #include <com/sun/star/xml/dom/XNode.hpp>
      31             : #include <com/sun/star/xml/dom/XAttr.hpp>
      32             : 
      33             : #include <node.hxx>
      34             : 
      35             : namespace DOM
      36             : {
      37             :     typedef ::std::pair< OString, OString > stringpair_t;
      38             : 
      39             :     typedef ::cppu::ImplInheritanceHelper1< CNode, css::xml::dom::XAttr > CAttr_Base;
      40             : 
      41     1304762 :     class CAttr
      42             :         : public CAttr_Base
      43             :     {
      44             :     private:
      45             :         friend class CDocument;
      46             : 
      47             :     private:
      48             :         xmlAttrPtr m_aAttrPtr;
      49             :         ::std::unique_ptr< stringpair_t > m_pNamespace;
      50             : 
      51             :     protected:
      52             :         CAttr(CDocument const& rDocument, ::osl::Mutex const& rMutex,
      53             :                 xmlAttrPtr const pAttr);
      54             : 
      55             :     public:
      56             :         /// return the libxml namespace corresponding to m_pNamespace on pNode
      57             :         xmlNsPtr GetNamespace(xmlNodePtr const pNode);
      58             : 
      59             :         virtual bool IsChildTypeAllowed(css::xml::dom::NodeType const nodeType) SAL_OVERRIDE;
      60             : 
      61             :         /**
      62             :         Returns the name of this attribute.
      63             :         */
      64             :         virtual OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      65             : 
      66             :         /**
      67             :         The Element node this attribute is attached to or null if this
      68             :         attribute is not in use.
      69             :         */
      70             :         virtual css::uno::Reference< css::xml::dom::XElement > SAL_CALL getOwnerElement() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      71             : 
      72             :         /**
      73             :         If this attribute was explicitly given a value in the original
      74             :         document, this is true; otherwise, it is false.
      75             :         */
      76             :         virtual sal_Bool SAL_CALL getSpecified()throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      77             : 
      78             :         /**
      79             :         On retrieval, the value of the attribute is returned as a string.
      80             :         */
      81             :         virtual OUString SAL_CALL getValue() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      82             : 
      83             :         /**
      84             :         Sets the value of the attribute from a string.
      85             :         */
      86             : 
      87             :         virtual void SAL_CALL setValue(const OUString& value) throw (css::uno::RuntimeException, css::xml::dom::DOMException, std::exception) SAL_OVERRIDE;
      88             : 
      89             :         // resolve uno inheritance problems...
      90             :         // overrides for XNode base
      91             :         virtual OUString SAL_CALL getNodeName()
      92             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      93             :         virtual OUString SAL_CALL getNodeValue()
      94             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      95             :         virtual OUString SAL_CALL getLocalName()
      96             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      97             : 
      98             :     // --- delegation for XNode base.
      99           1 :     virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL appendChild(const css::uno::Reference< css::xml::dom::XNode >& newChild)
     100             :         throw (css::uno::RuntimeException, css::xml::dom::DOMException, std::exception) SAL_OVERRIDE
     101             :     {
     102           1 :         return CNode::appendChild(newChild);
     103             :     }
     104           2 :     virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL cloneNode(sal_Bool deep)
     105             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     106             :     {
     107           2 :         return CNode::cloneNode(deep);
     108             :     }
     109           1 :     virtual css::uno::Reference< css::xml::dom::XNamedNodeMap > SAL_CALL getAttributes()
     110             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     111             :     {
     112           1 :         return CNode::getAttributes();
     113             :     }
     114           1 :     virtual css::uno::Reference< css::xml::dom::XNodeList > SAL_CALL getChildNodes()
     115             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     116             :     {
     117           1 :         return CNode::getChildNodes();
     118             :     }
     119           7 :     virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getFirstChild()
     120             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     121             :     {
     122           7 :         return CNode::getFirstChild();
     123             :     }
     124           4 :     virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getLastChild()
     125             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     126             :     {
     127           4 :         return CNode::getLastChild();
     128             :     }
     129             :     virtual OUString SAL_CALL getNamespaceURI()
     130             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     131           1 :     virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getNextSibling()
     132             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     133             :     {
     134           1 :         return CNode::getNextSibling();
     135             :     }
     136           1 :     virtual css::xml::dom::NodeType SAL_CALL getNodeType()
     137             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     138             :     {
     139           1 :         return CNode::getNodeType();
     140             :     }
     141          42 :     virtual css::uno::Reference< css::xml::dom::XDocument > SAL_CALL getOwnerDocument()
     142             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     143             :     {
     144          42 :         return CNode::getOwnerDocument();
     145             :     }
     146           5 :     virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getParentNode()
     147             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     148             :     {
     149           5 :         return CNode::getParentNode();
     150             :     }
     151             :     virtual OUString SAL_CALL getPrefix()
     152             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     153           1 :     virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getPreviousSibling()
     154             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     155             :     {
     156           1 :         return CNode::getPreviousSibling();
     157             :     }
     158           1 :     virtual sal_Bool SAL_CALL hasAttributes()
     159             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     160             :     {
     161           1 :         return CNode::hasAttributes();
     162             :     }
     163           4 :     virtual sal_Bool SAL_CALL hasChildNodes()
     164             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     165             :     {
     166           4 :         return CNode::hasChildNodes();
     167             :     }
     168           4 :     virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL insertBefore(
     169             :             const css::uno::Reference< css::xml::dom::XNode >& newChild, const css::uno::Reference< css::xml::dom::XNode >& refChild)
     170             :         throw (css::uno::RuntimeException, css::xml::dom::DOMException, std::exception) SAL_OVERRIDE
     171             :     {
     172           4 :         return CNode::insertBefore(newChild, refChild);
     173             :     }
     174           1 :     virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver)
     175             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     176             :     {
     177           1 :         return CNode::isSupported(feature, ver);
     178             :     }
     179           1 :     virtual void SAL_CALL normalize()
     180             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     181             :     {
     182           1 :         CNode::normalize();
     183           1 :     }
     184           3 :     virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL removeChild(const css::uno::Reference< css::xml::dom::XNode >& oldChild)
     185             :         throw (css::uno::RuntimeException, css::xml::dom::DOMException, std::exception) SAL_OVERRIDE
     186             :     {
     187           3 :         return CNode::removeChild(oldChild);
     188             :     }
     189           5 :     virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL replaceChild(
     190             :             const css::uno::Reference< css::xml::dom::XNode >& newChild, const css::uno::Reference< css::xml::dom::XNode >& oldChild)
     191             :         throw (css::uno::RuntimeException, css::xml::dom::DOMException, std::exception) SAL_OVERRIDE
     192             :     {
     193           5 :         return CNode::replaceChild(newChild, oldChild);
     194             :     }
     195           7 :     virtual void SAL_CALL setNodeValue(const OUString& nodeValue)
     196             :         throw (css::uno::RuntimeException, css::xml::dom::DOMException, std::exception) SAL_OVERRIDE
     197             :     {
     198           7 :         return setValue(nodeValue);
     199             :     }
     200             :     virtual void SAL_CALL setPrefix(const OUString& prefix)
     201             :         throw (css::uno::RuntimeException, css::xml::dom::DOMException, std::exception) SAL_OVERRIDE;
     202             : 
     203             :     };
     204             : }
     205             : 
     206             : #endif
     207             : 
     208             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11