LCOV - code coverage report
Current view: top level - dbaccess/source/core/recovery - storagetextstream.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 23 0.0 %
Date: 2012-08-25 Functions: 0 9 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 38 0.0 %

           Branch data     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 "storagetextstream.hxx"
      22                 :            : 
      23                 :            : #include <com/sun/star/io/XTextOutputStream.hpp>
      24                 :            : #include <com/sun/star/io/XActiveDataSource.hpp>
      25                 :            : 
      26                 :            : #include <comphelper/componentcontext.hxx>
      27                 :            : #include <tools/diagnose_ex.h>
      28                 :            : 
      29                 :            : //......................................................................................................................
      30                 :            : namespace dbaccess
      31                 :            : {
      32                 :            : //......................................................................................................................
      33                 :            : 
      34                 :            :     /** === begin UNO using === **/
      35                 :            :     using ::com::sun::star::uno::Reference;
      36                 :            :     using ::com::sun::star::uno::XInterface;
      37                 :            :     using ::com::sun::star::uno::UNO_QUERY;
      38                 :            :     using ::com::sun::star::uno::UNO_QUERY_THROW;
      39                 :            :     using ::com::sun::star::uno::UNO_SET_THROW;
      40                 :            :     using ::com::sun::star::uno::Exception;
      41                 :            :     using ::com::sun::star::uno::RuntimeException;
      42                 :            :     using ::com::sun::star::uno::Any;
      43                 :            :     using ::com::sun::star::uno::makeAny;
      44                 :            :     using ::com::sun::star::uno::Sequence;
      45                 :            :     using ::com::sun::star::uno::Type;
      46                 :            :     using ::com::sun::star::embed::XStorage;
      47                 :            :     using ::com::sun::star::io::XTextOutputStream;
      48                 :            :     using ::com::sun::star::io::XActiveDataSource;
      49                 :            :     /** === end UNO using === **/
      50                 :            : 
      51                 :            :     //==================================================================================================================
      52                 :            :     //= StorageTextOutputStream_Data
      53                 :            :     //==================================================================================================================
      54                 :          0 :     struct StorageTextOutputStream_Data
      55                 :            :     {
      56                 :            :         Reference< XTextOutputStream >  xTextOutput;
      57                 :            :     };
      58                 :            : 
      59                 :            :     //==================================================================================================================
      60                 :            :     //= helper
      61                 :            :     //==================================================================================================================
      62                 :            :     namespace
      63                 :            :     {
      64                 :            :         //--------------------------------------------------------------------------------------------------------------
      65                 :          0 :         static const ::rtl::OUString& lcl_getTextStreamEncodingName()
      66                 :            :         {
      67 [ #  # ][ #  # ]:          0 :             static const ::rtl::OUString s_sMapStreamEncodingName( RTL_CONSTASCII_USTRINGPARAM( "UTF-8" ) );
         [ #  # ][ #  # ]
      68                 :          0 :             return s_sMapStreamEncodingName;
      69                 :            :         }
      70                 :            : 
      71                 :            :         //--------------------------------------------------------------------------------------------------------------
      72                 :          0 :         static const ::rtl::OUString& lcl_getLineFeed()
      73                 :            :         {
      74 [ #  # ][ #  # ]:          0 :             static const ::rtl::OUString s_sLineFeed( sal_Unicode( '\n' ) );
      75                 :          0 :             return s_sLineFeed;
      76                 :            :         }
      77                 :            :     }
      78                 :            : 
      79                 :            :     //==================================================================================================================
      80                 :            :     //= StorageTextOutputStream
      81                 :            :     //==================================================================================================================
      82                 :            :     //------------------------------------------------------------------------------------------------------------------
      83                 :          0 :     StorageTextOutputStream::StorageTextOutputStream(   const ::comphelper::ComponentContext& i_rContext,
      84                 :            :                                                         const Reference< XStorage >& i_rParentStorage,
      85                 :            :                                                         const ::rtl::OUString& i_rStreamName
      86                 :            :                                                     )
      87                 :            :         :StorageOutputStream( i_rContext, i_rParentStorage, i_rStreamName )
      88 [ #  # ][ #  # ]:          0 :         ,m_pData( new StorageTextOutputStream_Data )
      89                 :            :     {
      90 [ #  # ][ #  # ]:          0 :         m_pData->xTextOutput.set( i_rContext.createComponent( "com.sun.star.io.TextOutputStream" ), UNO_QUERY_THROW );
      91 [ #  # ][ #  # ]:          0 :         m_pData->xTextOutput->setEncoding( lcl_getTextStreamEncodingName() );
                 [ #  # ]
      92                 :            : 
      93         [ #  # ]:          0 :         Reference< XActiveDataSource > xDataSource( m_pData->xTextOutput, UNO_QUERY_THROW );
      94 [ #  # ][ #  # ]:          0 :         xDataSource->setOutputStream( getOutputStream() );
      95                 :          0 :     }
      96                 :            : 
      97                 :            :     //------------------------------------------------------------------------------------------------------------------
      98                 :          0 :     StorageTextOutputStream::~StorageTextOutputStream()
      99                 :            :     {
     100         [ #  # ]:          0 :     }
     101                 :            : 
     102                 :            :     //------------------------------------------------------------------------------------------------------------------
     103                 :          0 :     void StorageTextOutputStream::writeLine( const ::rtl::OUString& i_rLine )
     104                 :            :     {
     105         [ #  # ]:          0 :         ENSURE_OR_RETURN_VOID( m_pData->xTextOutput.is(), "no text output" );
     106                 :            : 
     107                 :          0 :         m_pData->xTextOutput->writeString( i_rLine );
     108                 :          0 :         m_pData->xTextOutput->writeString( lcl_getLineFeed() );
     109                 :            :     }
     110                 :            : 
     111                 :            :     //------------------------------------------------------------------------------------------------------------------
     112                 :          0 :     void StorageTextOutputStream::writeLine()
     113                 :            :     {
     114         [ #  # ]:          0 :         ENSURE_OR_RETURN_VOID( m_pData->xTextOutput.is(), "no text output" );
     115                 :            : 
     116                 :          0 :         m_pData->xTextOutput->writeString( lcl_getLineFeed() );
     117                 :            :     }
     118                 :            : 
     119                 :            : //......................................................................................................................
     120                 :            : } // namespace dbaccess
     121                 :            : //......................................................................................................................
     122                 :            : 
     123                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10