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

Generated by: LCOV version 1.10