LCOV - code coverage report
Current view: top level - ucb/source/ucp/gio - gio_inputstream.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 39 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 9 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             : #include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
      21             : #include <ucbhelper/cancelcommandexecution.hxx>
      22             : #include <string.h>
      23             : 
      24             : #include "gio_inputstream.hxx"
      25             : #include "gio_content.hxx"
      26             : 
      27             : using namespace com::sun::star;
      28             : 
      29             : namespace gio
      30             : {
      31             : 
      32           0 : InputStream::InputStream(GFileInputStream *pStream) : Seekable(G_SEEKABLE(pStream)), mpStream(pStream)
      33             : {
      34           0 :     if (!mpStream)
      35           0 :         throw io::NotConnectedException();
      36           0 : }
      37             : 
      38           0 : InputStream::~InputStream()
      39             : {
      40           0 :     closeInput();
      41           0 : }
      42             : 
      43           0 : sal_Int32 SAL_CALL InputStream::available()
      44             :     throw( io::NotConnectedException, io::IOException, uno::RuntimeException, std::exception )
      45             : {
      46           0 :     return 0;
      47             : }
      48             : 
      49           0 : void SAL_CALL InputStream::closeInput()
      50             :     throw( io::NotConnectedException, io::IOException, uno::RuntimeException, std::exception )
      51             : {
      52           0 :     if (mpStream)
      53           0 :         g_input_stream_close(G_INPUT_STREAM(mpStream), NULL, NULL);
      54           0 : }
      55             : 
      56           0 : void SAL_CALL InputStream::skipBytes( sal_Int32 nBytesToSkip )
      57             :     throw( io::NotConnectedException, io::BufferSizeExceededException,
      58             :       io::IOException, uno::RuntimeException, std::exception )
      59             : {
      60           0 :     if (!mpStream)
      61           0 :         throw io::NotConnectedException();
      62             : 
      63           0 :     if (!g_seekable_can_seek(G_SEEKABLE(mpStream)))
      64             :         throw io::IOException("Seek unsupported",
      65           0 :             static_cast< cppu::OWeakObject * >(this));
      66             : 
      67           0 :     GError *pError=NULL;
      68           0 :     if (!g_seekable_seek(G_SEEKABLE(mpStream), nBytesToSkip, G_SEEK_CUR, NULL, &pError))
      69           0 :         convertToIOException(pError, static_cast< cppu::OWeakObject * >(this));
      70           0 : }
      71             : 
      72           0 : sal_Int32 SAL_CALL InputStream::readBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
      73             :     throw( io::NotConnectedException, io::BufferSizeExceededException,
      74             :       io::IOException, uno::RuntimeException, std::exception )
      75             : {
      76           0 :     if (!mpStream)
      77           0 :         throw io::NotConnectedException();
      78             : 
      79             :     try
      80             :     {
      81           0 :         aData.realloc( nBytesToRead );
      82             :     }
      83           0 :     catch ( const uno::Exception & )
      84             :     {
      85           0 :         throw io::BufferSizeExceededException();
      86             :     }
      87             : 
      88           0 :     gsize nBytesRead = 0;
      89           0 :     GError *pError=NULL;
      90           0 :     if (!g_input_stream_read_all(G_INPUT_STREAM(mpStream), aData.getArray(), nBytesToRead, &nBytesRead, NULL, &pError))
      91           0 :         convertToIOException(pError, static_cast< cppu::OWeakObject * >(this));
      92           0 :     aData.realloc(nBytesRead);
      93           0 :     return nBytesRead;
      94             : }
      95             : 
      96           0 : sal_Int32 SAL_CALL InputStream::readSomeBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead )
      97             :     throw( io::NotConnectedException, io::BufferSizeExceededException,
      98             :       io::IOException, uno::RuntimeException, std::exception )
      99             : {
     100           0 :     return readBytes(aData, nMaxBytesToRead);
     101             : }
     102             : 
     103           0 : uno::Any InputStream::queryInterface( const uno::Type &type ) throw( uno::RuntimeException, std::exception )
     104             : {
     105             :     uno::Any aRet = ::cppu::queryInterface ( type,
     106           0 :         static_cast< XInputStream * >( this ) );
     107             : 
     108           0 :     return aRet.hasValue() ? aRet : Seekable::queryInterface( type );
     109             : }
     110             : 
     111             : }
     112             : 
     113             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11