LCOV - code coverage report
Current view: top level - include/toolkit/controls - eventcontainer.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 5 5 100.0 %
Date: 2015-06-13 12:38:46 Functions: 4 5 80.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_TOOLKIT_CONTROLS_EVENTCONTAINER_HXX
      21             : #define INCLUDED_TOOLKIT_CONTROLS_EVENTCONTAINER_HXX
      22             : 
      23             : #include <osl/diagnose.h>
      24             : #include <com/sun/star/container/XNameContainer.hpp>
      25             : #include <com/sun/star/container/XContainer.hpp>
      26             : 
      27             : #include <toolkit/helper/listenermultiplexer.hxx>
      28             : 
      29             : #include <cppuhelper/implbase2.hxx>
      30             : #include <unordered_map>
      31             : 
      32             : typedef ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameContainer,
      33             :                                  ::com::sun::star::container::XContainer > NameContainerHelper;
      34             : 
      35             : 
      36             : namespace toolkit
      37             : {
      38             : 
      39             : // Hashtable to optimize
      40             : typedef std::unordered_map
      41             : <
      42             :     OUString,
      43             :     sal_Int32,
      44             :     OUStringHash
      45             : >
      46             : NameContainerNameMap;
      47             : 
      48             : 
      49           3 : class NameContainer_Impl : public NameContainerHelper
      50             : {
      51             :     NameContainerNameMap mHashMap;
      52             :     ::com::sun::star::uno::Sequence< OUString > mNames;
      53             :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > mValues;
      54             :     sal_Int32 mnElementCount;
      55             :     ::com::sun::star::uno::Type mType;
      56             : 
      57             :     ContainerListenerMultiplexer maContainerListeners;
      58             : 
      59             : public:
      60          30 :     NameContainer_Impl( ::com::sun::star::uno::Type const & aType )
      61             :         : mnElementCount( 0 ),
      62             :           mType( aType ),
      63          30 :           maContainerListeners( *this )
      64             :     {
      65          30 :     }
      66             : 
      67             :     // Methods XElementAccess
      68             :     virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  )
      69             :         throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      70             :     virtual sal_Bool SAL_CALL hasElements(  )
      71             :         throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      72             : 
      73             :     // Methods XNameAccess
      74             :     virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName )
      75             :         throw(::com::sun::star::container::NoSuchElementException,
      76             :               ::com::sun::star::lang::WrappedTargetException,
      77             :               ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      78             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames(  )
      79             :         throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      80             :     virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
      81             :         throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      82             : 
      83             :     // Methods XNameReplace
      84             :     virtual void SAL_CALL replaceByName( const OUString& aName, const ::com::sun::star::uno::Any& aElement )
      85             :         throw(::com::sun::star::lang::IllegalArgumentException,
      86             :               ::com::sun::star::container::NoSuchElementException,
      87             :               ::com::sun::star::lang::WrappedTargetException,
      88             :               ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      89             : 
      90             :     // Methods XNameContainer
      91             :     virtual void SAL_CALL insertByName( const OUString& aName, const ::com::sun::star::uno::Any& aElement )
      92             :         throw(::com::sun::star::lang::IllegalArgumentException,
      93             :               ::com::sun::star::container::ElementExistException,
      94             :               ::com::sun::star::lang::WrappedTargetException,
      95             :               ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      96             :     virtual void SAL_CALL removeByName( const OUString& Name )
      97             :         throw(::com::sun::star::container::NoSuchElementException,
      98             :               ::com::sun::star::lang::WrappedTargetException,
      99             :               ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     100             : 
     101             :     // Methods XContainer
     102             :     void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener )
     103             :         throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     104             :     void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener )
     105             :         throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     106             : };
     107             : 
     108           6 : class ScriptEventContainer : public NameContainer_Impl
     109             : {
     110             : public:
     111             :     ScriptEventContainer();
     112             : };
     113             : 
     114             : 
     115             : }   // namespace toolkit_namecontainer
     116             : 
     117             : #endif // INCLUDED_TOOLKIT_CONTROLS_EVENTCONTAINER_HXX
     118             : 
     119             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11