LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/osl - pipe.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 57 68 83.8 %
Date: 2012-08-25 Functions: 19 22 86.4 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 10 16 62.5 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #ifndef _OSL_PIPE_HXX_
      29                 :            : #define _OSL_PIPE_HXX_
      30                 :            : 
      31                 :            : #include <osl/pipe_decl.hxx>
      32                 :            : 
      33                 :            : namespace osl
      34                 :            : {
      35                 :            :     //______________________________________________________________________________
      36                 :        924 :     inline Pipe::Pipe()
      37                 :        924 :         : m_handle( 0 )
      38                 :        924 :     {}
      39                 :            : 
      40                 :            :     //______________________________________________________________________________
      41                 :            :     inline Pipe::Pipe(const ::rtl::OUString& strName, oslPipeOptions Options )
      42                 :            :         : m_handle( osl_createPipe( strName.pData, Options , 0 ) )
      43                 :            :     {}
      44                 :            : 
      45                 :            :     //______________________________________________________________________________
      46                 :        440 :     inline Pipe::Pipe(const ::rtl::OUString& strName, oslPipeOptions Options,const Security & rSecurity)
      47                 :        440 :         : m_handle( osl_createPipe( strName.pData, Options , rSecurity.getHandle() ) )
      48                 :        440 :     {}
      49                 :            : 
      50                 :            :     //______________________________________________________________________________
      51                 :            :     inline Pipe::Pipe(const Pipe& pipe )
      52                 :            :         : m_handle( pipe.m_handle )
      53                 :            :     {
      54                 :            :         if( m_handle )
      55                 :            :             osl_acquirePipe( m_handle );
      56                 :            :     }
      57                 :            : 
      58                 :            :     //______________________________________________________________________________
      59                 :        352 :     inline Pipe::Pipe( oslPipe pipe, __sal_NoAcquire )
      60                 :        352 :         : m_handle ( pipe )
      61                 :        352 :     {}
      62                 :            : 
      63                 :            :     //______________________________________________________________________________
      64                 :          0 :     inline Pipe::Pipe(oslPipe pipe)
      65                 :          0 :         : m_handle( pipe )
      66                 :            :     {
      67         [ #  # ]:          0 :         if( m_handle )
      68                 :          0 :             osl_acquirePipe( m_handle );
      69                 :          0 :     }
      70                 :            : 
      71                 :            :     //______________________________________________________________________________
      72                 :       1710 :     inline Pipe::~Pipe()
      73                 :            :     {
      74         [ +  + ]:       1710 :         if( m_handle )
      75                 :       1378 :             osl_releasePipe( m_handle );
      76                 :       1710 :     }
      77                 :            : 
      78                 :            :     //______________________________________________________________________________
      79                 :        184 :     inline sal_Bool Pipe::create( const ::rtl::OUString & strName,
      80                 :            :                                   oslPipeOptions Options, const Security &rSec )
      81                 :            :     {
      82         [ +  - ]:        184 :         *this = Pipe( strName, Options, rSec );
      83                 :        184 :         return is();
      84                 :            :     }
      85                 :            : 
      86                 :            :     //______________________________________________________________________________
      87                 :            :     inline sal_Bool Pipe::create( const ::rtl::OUString & strName, oslPipeOptions Options  )
      88                 :            :     {
      89                 :            :         *this = Pipe( strName, Options );
      90                 :            :         return is();
      91                 :            :     }
      92                 :            :     //______________________________________________________________________________
      93                 :        924 :     inline Pipe& SAL_CALL Pipe::operator= (const Pipe& pipe)
      94                 :            :     {
      95                 :        924 :         *this = pipe.getHandle();
      96                 :        924 :         return *this;
      97                 :            :     }
      98                 :            : 
      99                 :            :     //______________________________________________________________________________
     100                 :        924 :     inline Pipe & SAL_CALL Pipe::operator=( oslPipe pipe)
     101                 :            :     {
     102         [ +  + ]:        924 :         if( pipe )
     103                 :        806 :             osl_acquirePipe( pipe );
     104         [ -  + ]:        924 :         if( m_handle )
     105                 :          0 :             osl_releasePipe( m_handle );
     106                 :        924 :         m_handle = pipe;
     107                 :        924 :         return *this;
     108                 :            :     }
     109                 :            : 
     110                 :            :     //______________________________________________________________________________
     111                 :       1082 :     inline sal_Bool SAL_CALL Pipe::is() const
     112                 :            :     {
     113                 :       1082 :         return m_handle != 0;
     114                 :            :     }
     115                 :            : 
     116                 :            :     //______________________________________________________________________________
     117                 :            :     inline sal_Bool SAL_CALL Pipe::operator==( const Pipe& rPipe ) const
     118                 :            :     {
     119                 :            :         return m_handle == rPipe.m_handle;
     120                 :            :     }
     121                 :            : 
     122                 :            :     //______________________________________________________________________________
     123                 :        670 :     inline void SAL_CALL Pipe::close()
     124                 :            :     {
     125                 :        670 :         osl_closePipe( m_handle );
     126                 :        670 :     }
     127                 :            : 
     128                 :            :     //______________________________________________________________________________
     129                 :         96 :     inline void SAL_CALL Pipe::clear()
     130                 :            :     {
     131         [ +  - ]:         96 :         if( m_handle )
     132                 :            :         {
     133                 :         96 :             osl_releasePipe( m_handle );
     134                 :         96 :             m_handle = 0;
     135                 :            :         }
     136                 :         96 :     }
     137                 :            : 
     138                 :            :     //______________________________________________________________________________
     139                 :        352 :     inline oslPipeError SAL_CALL Pipe::accept(StreamPipe& Connection)
     140                 :            :     {
     141         [ +  - ]:        352 :         Connection = StreamPipe( osl_acceptPipe( m_handle ), SAL_NO_ACQUIRE);
     142         [ +  + ]:        352 :         if( Connection.is() )
     143                 :        256 :             return osl_Pipe_E_None;
     144                 :            :         else
     145                 :        352 :             return getError();
     146                 :            :     }
     147                 :            : 
     148                 :            :     //______________________________________________________________________________
     149                 :        118 :     inline oslPipeError SAL_CALL Pipe::getError() const
     150                 :            :     {
     151                 :        118 :         return osl_getLastPipeError( 0 );
     152                 :            :     }
     153                 :            : 
     154                 :            :     //______________________________________________________________________________
     155                 :        924 :     inline oslPipe SAL_CALL Pipe::getHandle() const
     156                 :            :     {
     157                 :        924 :         return m_handle;
     158                 :            :     }
     159                 :            : 
     160                 :            :     //______________________________________________________________________________
     161                 :        378 :     inline StreamPipe::StreamPipe(){}
     162                 :            : 
     163                 :            :     //______________________________________________________________________________
     164                 :          0 :     inline StreamPipe::StreamPipe(oslPipe hPipe)
     165                 :          0 :         : Pipe( hPipe )
     166                 :            :     {
     167                 :          0 :     }
     168                 :            : 
     169                 :            :     //______________________________________________________________________________
     170                 :        158 :     inline StreamPipe::StreamPipe(const ::rtl::OUString& strName, oslPipeOptions Options, const Security &rSec )
     171                 :        158 :         : Pipe( strName, Options , rSec )
     172                 :        158 :     {}
     173                 :            : 
     174                 :            :     //______________________________________________________________________________
     175                 :            :     inline StreamPipe::StreamPipe(const ::rtl::OUString& strName, oslPipeOptions Options  )
     176                 :            :         : Pipe( strName, Options )
     177                 :            :     {}
     178                 :            : 
     179                 :            :     //______________________________________________________________________________
     180                 :            :     inline StreamPipe::StreamPipe(const StreamPipe& aPipe)
     181                 :            :         : Pipe( aPipe )
     182                 :            :     {}
     183                 :            :     //______________________________________________________________________________
     184                 :        352 :     inline StreamPipe::StreamPipe( oslPipe pipe, __sal_NoAcquire noacquire )
     185                 :        352 :         : Pipe( pipe , noacquire )
     186                 :        352 :     {}
     187                 :            : 
     188                 :            :     //______________________________________________________________________________
     189                 :     954240 :     inline sal_Int32 SAL_CALL StreamPipe::read(void* pBuffer, sal_Int32 n) const
     190                 :            :     {
     191                 :     954240 :         return osl_readPipe( m_handle, pBuffer, n );
     192                 :            :     }
     193                 :            : 
     194                 :            :     //______________________________________________________________________________
     195                 :     389800 :     inline sal_Int32 SAL_CALL StreamPipe::write(const void* pBuffer, sal_Int32 n) const
     196                 :            :     {
     197                 :     389800 :         return osl_writePipe( m_handle, pBuffer , n );
     198                 :            :     }
     199                 :            : 
     200                 :            :     //______________________________________________________________________________
     201                 :          0 :     inline sal_Int32 SAL_CALL StreamPipe::recv(void* pBuffer, sal_Int32 BytesToRead) const
     202                 :            :     {
     203                 :          0 :         return osl_receivePipe( m_handle, pBuffer , BytesToRead );
     204                 :            :     }
     205                 :            : 
     206                 :            :     //______________________________________________________________________________
     207                 :        158 :     inline sal_Int32 SAL_CALL StreamPipe::send(const void* pBuffer, sal_Int32 BytesToSend) const
     208                 :            :     {
     209                 :        158 :         return osl_sendPipe( m_handle, pBuffer , BytesToSend );
     210                 :            :     }
     211                 :            : 
     212                 :            : }
     213                 :            : #endif
     214                 :            : 
     215                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10