LCOV - code coverage report
Current view: top level - sw/source/core/inc - retrievedinputstreamdata.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 8 8 100.0 %
Date: 2014-11-03 Functions: 6 6 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             : #ifndef INCLUDED_SW_SOURCE_CORE_INC_RETRIEVEDINPUTSTREAMDATA_HXX
      20             : #define INCLUDED_SW_SOURCE_CORE_INC_RETRIEVEDINPUTSTREAMDATA_HXX
      21             : 
      22             : #include <tools/link.hxx>
      23             : #include <sal/types.h>
      24             : #include <osl/mutex.hxx>
      25             : #include <rtl/instance.hxx>
      26             : #include <com/sun/star/uno/Reference.hxx>
      27             : #include <com/sun/star/io/XInputStream.hpp>
      28             : 
      29             : #include <map>
      30             : 
      31             : #include <boost/weak_ptr.hpp>
      32             : 
      33             : class SwAsyncRetrieveInputStreamThreadConsumer;
      34             : 
      35             : /** Singleton class to manage retrieved input stream data in Writer
      36             : 
      37             :     OD 2007-01-29 #i73788#
      38             :     The instance of this class provides data container for retrieved input
      39             :     stream data. The data container is accessed via a key, which the data
      40             :     manager provides on creation of the data container.
      41             :     When a certain data container is filled with data, an user event is submitted
      42             :     to trigger the processing of with data.
      43             : */
      44           4 : class SwRetrievedInputStreamDataManager
      45             : {
      46             :     public:
      47             : 
      48             :         typedef sal_uInt64 tDataKey;
      49             : 
      50          32 :         struct tData
      51             :         {
      52             :             boost::weak_ptr< SwAsyncRetrieveInputStreamThreadConsumer > mpThreadConsumer;
      53             :             com::sun::star::uno::Reference<com::sun::star::io::XInputStream> mxInputStream;
      54             :             bool mbIsStreamReadOnly;
      55             : 
      56          16 :             tData()
      57             :                 : mpThreadConsumer(),
      58          16 :                   mbIsStreamReadOnly( false )
      59          16 :             {};
      60             : 
      61           8 :             tData( boost::weak_ptr< SwAsyncRetrieveInputStreamThreadConsumer > pThreadConsumer )
      62             :                 : mpThreadConsumer( pThreadConsumer ),
      63           8 :                   mbIsStreamReadOnly( false )
      64           8 :             {};
      65             :         };
      66             : 
      67             :         static SwRetrievedInputStreamDataManager& GetManager();
      68             : 
      69             :         tDataKey ReserveData( boost::weak_ptr< SwAsyncRetrieveInputStreamThreadConsumer > pThreadConsumer );
      70             : 
      71             :         void PushData( const tDataKey nDataKey,
      72             :                        com::sun::star::uno::Reference<com::sun::star::io::XInputStream> xInputStream,
      73             :                        const bool bIsStreamReadOnly );
      74             : 
      75             :         bool PopData( const tDataKey nDataKey,
      76             :                       tData& rData );
      77             : 
      78             :         DECL_LINK( LinkedInputStreamReady, SwRetrievedInputStreamDataManager::tDataKey* );
      79             : 
      80             :     private:
      81             : 
      82             :         static tDataKey mnNextKeyValue;
      83             : 
      84             :         osl::Mutex maMutex;
      85             : 
      86             :         std::map< tDataKey, tData > maInputStreamData;
      87             : };
      88             : #endif
      89             : 
      90             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10