LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/unotools - streamhelper.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 3 100.0 %
Date: 2013-07-09 Functions: 3 3 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             : #include "unotools/unotoolsdllapi.h"
      20             : 
      21             : #ifndef _UNOTOOLS_STREAMHELPER_HXX_
      22             : #define _UNOTOOLS_STREAMHELPER_HXX_
      23             : #include <com/sun/star/io/XInputStream.hpp>
      24             : #include <com/sun/star/io/XSeekable.hpp>
      25             : #include <osl/mutex.hxx>
      26             : #include <cppuhelper/implbase2.hxx>
      27             : #include <tools/stream.hxx>
      28             : 
      29             : namespace utl
      30             : {
      31             :     namespace stario    = ::com::sun::star::io;
      32             :     namespace staruno   = ::com::sun::star::uno;
      33             : 
      34             : /**
      35             :  * The helper implementation for a using input streams based on SvLockBytes.
      36             :  *
      37             :  * @author  Dirk Grobler
      38             :  * @since   00/28/03
      39             :  */
      40             :     typedef ::cppu::WeakImplHelper2<stario::XInputStream, stario::XSeekable> InputStreamHelper_Base;
      41             :     // needed for some compilers
      42           2 : class UNOTOOLS_DLLPUBLIC OInputStreamHelper : public InputStreamHelper_Base
      43             : {
      44             :     ::osl::Mutex    m_aMutex;
      45             :     SvLockBytesRef  m_xLockBytes;
      46             :     sal_uInt32      m_nActPos;
      47             :     sal_Int32       m_nAvailable;   // this is typically the chunk(buffer) size
      48             : 
      49             : public:
      50           1 :     OInputStreamHelper(const SvLockBytesRef& _xLockBytes,
      51             :                        sal_uInt32 _nAvailable,
      52             :                        sal_uInt32 _nPos = 0)
      53             :         :m_xLockBytes(_xLockBytes)
      54             :         ,m_nActPos(_nPos)
      55           1 :         ,m_nAvailable(_nAvailable){}
      56             : 
      57             : // staruno::XInterface
      58             :     virtual void SAL_CALL acquire() throw ();
      59             :     virtual void SAL_CALL release() throw ();
      60             : 
      61             : // stario::XInputStream
      62             :     virtual sal_Int32 SAL_CALL readBytes( staruno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw(stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException);
      63             :     virtual sal_Int32 SAL_CALL readSomeBytes( staruno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException);
      64             :     virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) throw(stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException);
      65             :     virtual sal_Int32 SAL_CALL available(  ) throw(stario::NotConnectedException, stario::IOException, staruno::RuntimeException);
      66             :     virtual void SAL_CALL closeInput(  ) throw (stario::NotConnectedException, stario::IOException, staruno::RuntimeException);
      67             : 
      68             :     virtual void SAL_CALL seek( sal_Int64 location ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
      69             :     virtual sal_Int64 SAL_CALL getPosition(  ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
      70             :     virtual sal_Int64 SAL_CALL getLength(  ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
      71             : };
      72             : 
      73             : }   // namespace utl
      74             : 
      75             : 
      76             : #endif // _UNOTOOLS_STREAM_WRAPPER_HXX_
      77             : 
      78             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10