LCOV - code coverage report
Current view: top level - include/unotools - streamhelper.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 3 3 100.0 %
Date: 2014-11-03 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 INCLUDED_UNOTOOLS_STREAMHELPER_HXX
      22             : #define INCLUDED_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             : 
      32             : /**
      33             :  * The helper implementation for a using input streams based on SvLockBytes.
      34             :  *
      35             :  * @author  Dirk Grobler
      36             :  * @since   00/28/03
      37             :  */
      38             :     typedef ::cppu::WeakImplHelper2<css::io::XInputStream, css::io::XSeekable> InputStreamHelper_Base;
      39             :     // needed for some compilers
      40           4 : class UNOTOOLS_DLLPUBLIC OInputStreamHelper : public InputStreamHelper_Base
      41             : {
      42             :     ::osl::Mutex    m_aMutex;
      43             :     SvLockBytesRef  m_xLockBytes;
      44             :     sal_uInt64      m_nActPos;
      45             :     sal_Int32       m_nAvailable;   // this is typically the chunk(buffer) size
      46             : 
      47             : public:
      48           2 :     OInputStreamHelper(const SvLockBytesRef& _xLockBytes,
      49             :                        sal_uInt32 _nAvailable,
      50             :                        sal_uInt64 _nPos = 0)
      51             :         :m_xLockBytes(_xLockBytes)
      52             :         ,m_nActPos(_nPos)
      53           2 :         ,m_nAvailable(_nAvailable){}
      54             : 
      55             : // css::uno::XInterface
      56             :     virtual void SAL_CALL acquire() throw () SAL_OVERRIDE;
      57             :     virtual void SAL_CALL release() throw () SAL_OVERRIDE;
      58             : 
      59             : // css::io::XInputStream
      60             :     virtual sal_Int32 SAL_CALL readBytes( css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw(css::io::NotConnectedException, css::io::BufferSizeExceededException, css::io::IOException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      61             :     virtual sal_Int32 SAL_CALL readSomeBytes( css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(css::io::NotConnectedException, css::io::BufferSizeExceededException, css::io::IOException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      62             :     virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) throw(css::io::NotConnectedException, css::io::BufferSizeExceededException, css::io::IOException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      63             :     virtual sal_Int32 SAL_CALL available(  ) throw(css::io::NotConnectedException, css::io::IOException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      64             :     virtual void SAL_CALL closeInput(  ) throw (css::io::NotConnectedException, css::io::IOException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      65             : 
      66             :     virtual void SAL_CALL seek( sal_Int64 location ) throw(css::lang::IllegalArgumentException, css::io::IOException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      67             :     virtual sal_Int64 SAL_CALL getPosition(  ) throw(css::io::IOException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      68             :     virtual sal_Int64 SAL_CALL getLength(  ) throw(css::io::IOException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      69             : };
      70             : 
      71             : }   // namespace utl
      72             : 
      73             : #endif // _UNOTOOLS_STREAM_WRAPPER_HXX_
      74             : 
      75             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10