LCOV - code coverage report
Current view: top level - unoxml/source/dom - saxbuilder.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 1 100.0 %
Date: 2014-11-03 Functions: 2 2 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_SAXBUILDER_HXX
      21             : #define INCLUDED_UNOXML_SOURCE_DOM_SAXBUILDER_HXX
      22             : 
      23             : #include <stack>
      24             : #include <map>
      25             : 
      26             : #include <sal/types.h>
      27             : #include <osl/mutex.hxx>
      28             : #include <cppuhelper/implbase2.hxx>
      29             : #include <com/sun/star/uno/Reference.h>
      30             : #include <com/sun/star/uno/Sequence.h>
      31             : 
      32             : #include <com/sun/star/uno/XInterface.hpp>
      33             : #include <com/sun/star/uno/Exception.hpp>
      34             : #include <com/sun/star/xml/dom/XSAXDocumentBuilder2.hpp>
      35             : #include <com/sun/star/xml/dom/SAXDocumentBuilderState.hpp>
      36             : #include <com/sun/star/xml/dom/XDocument.hpp>
      37             : #include <com/sun/star/xml/dom/XDocumentFragment.hpp>
      38             : #include <com/sun/star/xml/sax/XLocator.hpp>
      39             : #include <com/sun/star/xml/sax/XAttributeList.hpp>
      40             : #include <com/sun/star/lang/XServiceInfo.hpp>
      41             : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
      42             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      43             : 
      44             : namespace DOM
      45             : {
      46             : 
      47             :     typedef std::stack< css::uno::Reference< css::xml::dom::XNode > > NodeStack;
      48             :     typedef std::map< OUString, OUString > NSMap;
      49             :     typedef std::map< OUString, OUString > AttrMap;
      50             :     typedef std::stack< NSMap > NSStack;
      51             : 
      52        2192 :     class  CSAXDocumentBuilder
      53             :         : public ::cppu::WeakImplHelper2< css::xml::dom::XSAXDocumentBuilder2, css::lang::XServiceInfo >
      54             :     {
      55             : 
      56             :     private:
      57             :         ::osl::Mutex m_Mutex;
      58             :         const css::uno::Reference< css::lang::XMultiServiceFactory > m_aServiceManager;
      59             : 
      60             :         css::xml::dom::SAXDocumentBuilderState m_aState;
      61             :         NodeStack m_aNodeStack;
      62             :         NSStack m_aNSStack;
      63             : 
      64             :         OUString resolvePrefix(const OUString& aPrefix);
      65             : 
      66             :         css::uno::Reference< css::xml::dom::XDocument > m_aDocument;
      67             :         css::uno::Reference< css::xml::dom::XDocumentFragment > m_aFragment;
      68             :         css::uno::Reference< css::xml::sax::XLocator > m_aLocator;
      69             : 
      70             : 
      71             :     public:
      72             : 
      73             :         // call for factory
      74             :         static css::uno::Reference< XInterface > getInstance(const css::uno::Reference < css::lang::XMultiServiceFactory >& xFactory);
      75             : 
      76             :         // static helpers for service info and component management
      77             :         static const char* aImplementationName;
      78             :     static const char* aSupportedServiceNames[];
      79             :         static OUString _getImplementationName();
      80             :         static css::uno::Sequence< OUString > _getSupportedServiceNames();
      81             :         static css::uno::Reference< XInterface > _getInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr);
      82             : 
      83             :         CSAXDocumentBuilder(const css::uno::Reference< css::lang::XMultiServiceFactory >& mgr);
      84             : 
      85             :         // XServiceInfo
      86             :         virtual OUString SAL_CALL getImplementationName()
      87             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      88             :         virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
      89             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      90             :         virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames ()
      91             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      92             : 
      93             :         // XDocumentHandler
      94             :         virtual void SAL_CALL startDocument()
      95             :             throw( css::uno::RuntimeException, css::xml::sax::SAXException, std::exception ) SAL_OVERRIDE;
      96             :         virtual void SAL_CALL endDocument()
      97             :             throw( css::uno::RuntimeException, css::xml::sax::SAXException, std::exception ) SAL_OVERRIDE;
      98             :         virtual void SAL_CALL startElement( const OUString& aName,
      99             :              const css::uno::Reference< css::xml::sax::XAttributeList >& xAttribs )
     100             :             throw( css::uno::RuntimeException, css::xml::sax::SAXException, std::exception ) SAL_OVERRIDE;
     101             :         virtual void SAL_CALL endElement( const OUString& aName )
     102             :             throw( css::uno::RuntimeException, css::xml::sax::SAXException, std::exception ) SAL_OVERRIDE;
     103             :         virtual void SAL_CALL characters( const OUString& aChars )
     104             :             throw( css::uno::RuntimeException, css::xml::sax::SAXException, std::exception ) SAL_OVERRIDE;
     105             :         virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces )
     106             :             throw( css::uno::RuntimeException, css::xml::sax::SAXException, std::exception ) SAL_OVERRIDE;
     107             :         virtual void SAL_CALL processingInstruction( const OUString& aTarget,
     108             :              const OUString& aData )
     109             :             throw( css::uno::RuntimeException, css::xml::sax::SAXException, std::exception ) SAL_OVERRIDE;
     110             :         virtual void SAL_CALL setDocumentLocator( const css::uno::Reference< css::xml::sax::XLocator >& xLocator )
     111             :             throw( css::uno::RuntimeException, css::xml::sax::SAXException, std::exception ) SAL_OVERRIDE;
     112             : 
     113             : 
     114             :         // XSAXDocumentBuilder
     115             :         virtual css::xml::dom::SAXDocumentBuilderState SAL_CALL getState()
     116             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     117             :         virtual void SAL_CALL reset()
     118             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     119             :         virtual css::uno::Reference< css::xml::dom::XDocument > SAL_CALL getDocument()
     120             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     121             :         virtual css::uno::Reference< css::xml::dom::XDocumentFragment > SAL_CALL getDocumentFragment()
     122             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     123             :         virtual void SAL_CALL startDocumentFragment(const css::uno::Reference< css::xml::dom::XDocument >& ownerDoc)
     124             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     125             :         virtual void SAL_CALL endDocumentFragment()
     126             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     127             : 
     128             : 
     129             :     };
     130             : }
     131             : 
     132             : #endif
     133             : 
     134             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10