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

Generated by: LCOV version 1.10