LCOV - code coverage report
Current view: top level - unoxml/source/xpath - xpathapi.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 1 100.0 %
Date: 2015-06-13 12:38:46 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_XPATH_XPATHAPI_HXX
      21             : #define INCLUDED_UNOXML_SOURCE_XPATH_XPATHAPI_HXX
      22             : 
      23             : #include <map>
      24             : #include <vector>
      25             : 
      26             : #include <sal/types.h>
      27             : 
      28             : #include <cppuhelper/implbase2.hxx>
      29             : 
      30             : #include <com/sun/star/uno/Reference.h>
      31             : #include <com/sun/star/uno/Sequence.h>
      32             : 
      33             : #include <com/sun/star/uno/XInterface.hpp>
      34             : #include <com/sun/star/uno/Exception.hpp>
      35             : #include <com/sun/star/xml/xpath/XXPathAPI.hpp>
      36             : #include <com/sun/star/xml/dom/XNode.hpp>
      37             : #include <com/sun/star/xml/dom/XNodeList.hpp>
      38             : #include <com/sun/star/xml/xpath/XXPathObject.hpp>
      39             : #include <com/sun/star/xml/xpath/XXPathExtension.hpp>
      40             : #include <com/sun/star/xml/xpath/Libxml2ExtensionHandle.hpp>
      41             : #include <com/sun/star/xml/xpath/XPathException.hpp>
      42             : #include <com/sun/star/lang/XServiceInfo.hpp>
      43             : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
      44             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      45             : 
      46             : namespace XPath
      47             : {
      48             :     typedef std::map<OUString, OUString> nsmap_t;
      49             :     typedef std::vector< css::uno::Reference<css::xml::xpath::XXPathExtension> > extensions_t;
      50             : 
      51             :     typedef ::cppu::WeakImplHelper2
      52             :         <   css::xml::xpath::XXPathAPI
      53             :         ,   css::lang::XServiceInfo
      54             :         > CXPathAPI_Base;
      55             : 
      56       22616 :     class  CXPathAPI
      57             :         : public CXPathAPI_Base
      58             :     {
      59             : 
      60             :     private:
      61             :         ::osl::Mutex m_Mutex;
      62             :         nsmap_t m_nsmap;
      63             :         const css::uno::Reference< css::lang::XMultiServiceFactory > m_aFactory;
      64             :         extensions_t m_extensions;
      65             : 
      66             :     public:
      67             :         // ctor
      68             :         explicit CXPathAPI(
      69             :             const css::uno::Reference< css::lang::XMultiServiceFactory >&
      70             :                 rSMgr);
      71             : 
      72             :         // call for factory
      73             :         static css::uno::Reference< XInterface > getInstance(
      74             :             const css::uno::Reference < css::lang::XMultiServiceFactory >&
      75             :                 xFactory);
      76             : 
      77             :         // static helpers for service info and component management
      78             :         static const char* aImplementationName;
      79             :         static const char* aSupportedServiceNames[];
      80             :         static OUString _getImplementationName();
      81             :         static css::uno::Sequence< OUString > _getSupportedServiceNames();
      82             :         static css::uno::Reference< XInterface > _getInstance(
      83             :             const css::uno::Reference< css::lang::XMultiServiceFactory >&
      84             :                 rSMgr);
      85             : 
      86             :         // XServiceInfo
      87             :         virtual OUString SAL_CALL getImplementationName()
      88             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      89             :         virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
      90             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      91             :         virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames ()
      92             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      93             : 
      94             : 
      95             :         // --- XXPathAPI ---
      96             : 
      97             :         virtual void SAL_CALL registerNS(const OUString& aPrefix, const OUString& aURI)
      98             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      99             : 
     100             :         virtual void SAL_CALL unregisterNS(const OUString& aPrefix, const OUString& aURI)
     101             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     102             : 
     103             :         /**
     104             :         Use an XPath string to select a nodelist.
     105             :         */
     106             :         virtual css::uno::Reference< css::xml::dom::XNodeList > SAL_CALL selectNodeList(const css::uno::Reference< css::xml::dom::XNode >& contextNode, const OUString& str)
     107             :             throw (css::uno::RuntimeException, css::xml::xpath::XPathException, std::exception) SAL_OVERRIDE;
     108             : 
     109             :         /**
     110             :         Use an XPath string to select a nodelist.
     111             :         */
     112             :         virtual css::uno::Reference< css::xml::dom::XNodeList > SAL_CALL selectNodeListNS(const css::uno::Reference< css::xml::dom::XNode >& contextNode, const OUString& str, const css::uno::Reference< css::xml::dom::XNode >&  namespaceNode)
     113             :             throw (css::uno::RuntimeException, css::xml::xpath::XPathException, std::exception) SAL_OVERRIDE;
     114             : 
     115             :         /**
     116             :         Use an XPath string to select a single node.
     117             :         */
     118             :         virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL selectSingleNode(const css::uno::Reference< css::xml::dom::XNode >& contextNode, const OUString& str)
     119             :             throw (css::uno::RuntimeException, css::xml::xpath::XPathException, std::exception) SAL_OVERRIDE;
     120             : 
     121             :         /**
     122             :         Use an XPath string to select a single node.
     123             :         */
     124             :         virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL selectSingleNodeNS(const css::uno::Reference< css::xml::dom::XNode >& contextNode, const OUString& str, const css::uno::Reference< css::xml::dom::XNode >&  namespaceNode)
     125             :             throw (css::uno::RuntimeException, css::xml::xpath::XPathException, std::exception) SAL_OVERRIDE;
     126             : 
     127             :         virtual css::uno::Reference< css::xml::xpath::XXPathObject > SAL_CALL eval(const css::uno::Reference< css::xml::dom::XNode >& contextNode, const OUString& str)
     128             :             throw (css::uno::RuntimeException, css::xml::xpath::XPathException, std::exception) SAL_OVERRIDE;
     129             : 
     130             :         virtual css::uno::Reference< css::xml::xpath::XXPathObject > SAL_CALL evalNS(const css::uno::Reference< css::xml::dom::XNode >& contextNode, const OUString& str, const css::uno::Reference< css::xml::dom::XNode >&  namespaceNode)
     131             :             throw (css::uno::RuntimeException, css::xml::xpath::XPathException, std::exception) SAL_OVERRIDE;
     132             : 
     133             :         virtual void SAL_CALL registerExtension(const OUString& aName) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     134             :         virtual void SAL_CALL registerExtensionInstance(const css::uno::Reference< css::xml::xpath::XXPathExtension>& aExtension) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     135             : 
     136             :     };
     137             : }
     138             : 
     139             : #endif
     140             : 
     141             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11