LCOV - code coverage report
Current view: top level - dbaccess/source/core/recovery - storagestream.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 24 0.0 %
Date: 2014-04-14 Functions: 0 8 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 "storagestream.hxx"
      21             : 
      22             : #include <com/sun/star/embed/ElementModes.hpp>
      23             : 
      24             : #include <tools/diagnose_ex.h>
      25             : 
      26             : namespace dbaccess
      27             : {
      28             : 
      29             :     using ::com::sun::star::uno::Reference;
      30             :     using ::com::sun::star::uno::XInterface;
      31             :     using ::com::sun::star::uno::UNO_QUERY;
      32             :     using ::com::sun::star::uno::UNO_QUERY_THROW;
      33             :     using ::com::sun::star::uno::UNO_SET_THROW;
      34             :     using ::com::sun::star::uno::Exception;
      35             :     using ::com::sun::star::uno::RuntimeException;
      36             :     using ::com::sun::star::uno::Any;
      37             :     using ::com::sun::star::uno::makeAny;
      38             :     using ::com::sun::star::uno::Sequence;
      39             :     using ::com::sun::star::uno::Type;
      40             :     using ::com::sun::star::uno::XComponentContext;
      41             :     using ::com::sun::star::embed::XStorage;
      42             :     using ::com::sun::star::io::XStream;
      43             : 
      44             :     namespace ElementModes = ::com::sun::star::embed::ElementModes;
      45             : 
      46             :     // StorageOutputStream
      47           0 :     StorageOutputStream::StorageOutputStream(   const Reference<XComponentContext>& i_rContext,
      48             :                                                 const Reference< XStorage >& i_rParentStorage,
      49             :                                                 const OUString& i_rStreamName
      50             :                                              )
      51           0 :         :m_rContext( i_rContext )
      52             :     {
      53           0 :         ENSURE_OR_THROW( i_rParentStorage.is(), "illegal stream" );
      54             : 
      55             :         const Reference< XStream > xStream(
      56           0 :             i_rParentStorage->openStreamElement( i_rStreamName, ElementModes::READWRITE ), UNO_QUERY_THROW );
      57           0 :         m_xOutputStream.set( xStream->getOutputStream(), UNO_SET_THROW );
      58           0 :     }
      59             : 
      60           0 :     StorageOutputStream::~StorageOutputStream()
      61             :     {
      62           0 :     }
      63             : 
      64           0 :     void StorageOutputStream::close()
      65             :     {
      66           0 :         ENSURE_OR_RETURN_VOID( m_xOutputStream.is(), "already closed" );
      67           0 :         m_xOutputStream->closeOutput();
      68           0 :         m_xOutputStream.clear();
      69             : 
      70             :         // if you add additional functionality here, be aware that there are derived classes which
      71             :         // (legitimately) do not call this method here.
      72             :     }
      73             : 
      74             :     // StorageInputStream
      75           0 :     StorageInputStream::StorageInputStream( const Reference<XComponentContext>& i_rContext,
      76             :                                             const Reference< XStorage >& i_rParentStorage,
      77             :                                             const OUString& i_rStreamName
      78             :                                           )
      79           0 :         :m_rContext( i_rContext )
      80             :     {
      81           0 :         ENSURE_OR_THROW( i_rParentStorage.is(), "illegal stream" );
      82             : 
      83             :         const Reference< XStream > xStream(
      84           0 :             i_rParentStorage->openStreamElement( i_rStreamName, ElementModes::READ ), UNO_QUERY_THROW );
      85           0 :         m_xInputStream.set( xStream->getInputStream(), UNO_SET_THROW );
      86           0 :     }
      87             : 
      88           0 :     StorageInputStream::~StorageInputStream()
      89             :     {
      90           0 :     }
      91             : 
      92           0 :     void StorageInputStream::close()
      93             :     {
      94           0 :         ENSURE_OR_RETURN_VOID( m_xInputStream.is(), "already closed" );
      95           0 :         m_xInputStream->closeInput();
      96           0 :         m_xInputStream.clear();
      97             : 
      98             :         // if you add additional functionality here, be aware that there are derived classes which
      99             :         // (legitimately) do not call this method here.
     100             :     }
     101             : 
     102             : } // namespace dbaccess
     103             : 
     104             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10