LCOV - code coverage report
Current view: top level - include/comphelper - enumhelper.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_COMPHELPER_ENUMHELPER_HXX
      21             : #define INCLUDED_COMPHELPER_ENUMHELPER_HXX
      22             : 
      23             : #include <vector>
      24             : #include <com/sun/star/container/XNameAccess.hpp>
      25             : #include <com/sun/star/container/XEnumeration.hpp>
      26             : #include <com/sun/star/container/XIndexAccess.hpp>
      27             : #include <com/sun/star/lang/XEventListener.hpp>
      28             : #include <cppuhelper/implbase1.hxx>
      29             : #include <cppuhelper/implbase2.hxx>
      30             : #include <osl/mutex.hxx>
      31             : #include <comphelper/comphelperdllapi.h>
      32             : 
      33             : 
      34             : namespace comphelper
      35             : {
      36             : 
      37             : //= OEnumerationLock
      38             : 
      39      188004 : struct OEnumerationLock
      40             : {
      41             :     public:
      42             :         ::osl::Mutex m_aLock;
      43             : };
      44             : 
      45             : 
      46             : //= OEnumerationByName
      47             : 
      48             : /** provides an com.sun.star.container::XEnumeration access based
      49             :     on an object implementing the com.sun.star.container::XNameAccess interface
      50             : */
      51             : class COMPHELPER_DLLPUBLIC OEnumerationByName : private OEnumerationLock
      52             :                          , public ::cppu::WeakImplHelper2< css::container::XEnumeration ,
      53             :                                                            css::lang::XEventListener    >
      54             : {
      55             :     css::uno::Sequence< OUString >                m_aNames;
      56             :     sal_Int32                                           m_nPos;
      57             :     css::uno::Reference< css::container::XNameAccess >    m_xAccess;
      58             :     bool                                            m_bListening;
      59             : 
      60             : public:
      61             :     OEnumerationByName(const css::uno::Reference< css::container::XNameAccess >& _rxAccess);
      62             :     OEnumerationByName(const css::uno::Reference< css::container::XNameAccess >& _rxAccess,
      63             :                        const css::uno::Sequence< OUString >&             _aNames  );
      64             :     virtual ~OEnumerationByName();
      65             : 
      66             :     virtual sal_Bool SAL_CALL hasMoreElements(  ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      67             :     virtual css::uno::Any SAL_CALL nextElement(  )
      68             :         throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      69             : 
      70             :     virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      71             : 
      72             : private:
      73             :     COMPHELPER_DLLPRIVATE void impl_startDisposeListening();
      74             :     COMPHELPER_DLLPRIVATE void impl_stopDisposeListening();
      75             : };
      76             : 
      77             : 
      78             : //= OEnumerationByIndex
      79             : 
      80             : /** provides an com.sun.star.container::XEnumeration access based
      81             :     on an object implementing the com.sun.star.container::XNameAccess interface
      82             : */
      83             : class COMPHELPER_DLLPUBLIC OEnumerationByIndex : private OEnumerationLock
      84             :                           , public ::cppu::WeakImplHelper2< css::container::XEnumeration ,
      85             :                                                             css::lang::XEventListener    >
      86             : {
      87             :     sal_Int32                                         m_nPos;
      88             :     css::uno::Reference< css::container::XIndexAccess > m_xAccess;
      89             :     bool                                          m_bListening;
      90             : 
      91             : public:
      92             :     OEnumerationByIndex(const css::uno::Reference< css::container::XIndexAccess >& _rxAccess);
      93             :     virtual ~OEnumerationByIndex();
      94             : 
      95             :     virtual sal_Bool SAL_CALL hasMoreElements(  ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      96             :     virtual css::uno::Any SAL_CALL nextElement(  )
      97             :         throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      98             : 
      99             :     virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     100             : 
     101             : private:
     102             :     COMPHELPER_DLLPRIVATE void impl_startDisposeListening();
     103             :     COMPHELPER_DLLPRIVATE void impl_stopDisposeListening();
     104             : };
     105             : 
     106             : 
     107             : //= OAnyEnumeration
     108             : 
     109             : /** provides an com.sun.star.container::XEnumeration
     110             :     for an outside set vector of Any's.
     111             : 
     112             : */
     113             : class COMPHELPER_DLLPUBLIC OAnyEnumeration : private OEnumerationLock
     114             :                                            , public  ::cppu::WeakImplHelper1< css::container::XEnumeration >
     115             : {
     116             :     sal_Int32                         m_nPos;
     117             :     css::uno::Sequence< css::uno::Any > m_lItems;
     118             : 
     119             : public:
     120             :     OAnyEnumeration(const css::uno::Sequence< css::uno::Any >& lItems);
     121             :     virtual ~OAnyEnumeration();
     122             : 
     123             :     virtual sal_Bool SAL_CALL hasMoreElements(  ) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     124             :     virtual css::uno::Any SAL_CALL nextElement(  )
     125             :         throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     126             : 
     127             : };
     128             : 
     129             : 
     130             : }
     131             : //... namespace comphelper .......................................................
     132             : 
     133             : #endif // INCLUDED_COMPHELPER_ENUMHELPER_HXX
     134             : 
     135             : 
     136             : 
     137             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10