LCOV - code coverage report
Current view: top level - include/osl - pipe.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 52 63 82.5 %
Date: 2015-06-13 12:38:46 Functions: 17 20 85.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             : #ifndef INCLUDED_OSL_PIPE_HXX
      20             : #define INCLUDED_OSL_PIPE_HXX
      21             : 
      22             : #include <osl/pipe_decl.hxx>
      23             : 
      24             : namespace osl
      25             : {
      26             : 
      27         621 :     inline Pipe::Pipe()
      28         621 :         : m_handle( 0 )
      29         621 :     {}
      30             : 
      31             : 
      32             :     inline Pipe::Pipe(const ::rtl::OUString& strName, oslPipeOptions Options )
      33             :         : m_handle( osl_createPipe( strName.pData, Options , 0 ) )
      34             :     {}
      35             : 
      36             : 
      37         188 :     inline Pipe::Pipe(const ::rtl::OUString& strName, oslPipeOptions Options,const Security & rSecurity)
      38         188 :         : m_handle( osl_createPipe( strName.pData, Options , rSecurity.getHandle() ) )
      39         188 :     {}
      40             : 
      41             : 
      42             :     inline Pipe::Pipe(const Pipe& pipe )
      43             :         : m_handle( pipe.m_handle )
      44             :     {
      45             :         if( m_handle )
      46             :             osl_acquirePipe( m_handle );
      47             :     }
      48             : 
      49             : 
      50         242 :     inline Pipe::Pipe( oslPipe pipe, __sal_NoAcquire )
      51         242 :         : m_handle ( pipe )
      52         242 :     {}
      53             : 
      54             : 
      55           0 :     inline Pipe::Pipe(oslPipe pipe)
      56           0 :         : m_handle( pipe )
      57             :     {
      58           0 :         if( m_handle )
      59           0 :             osl_acquirePipe( m_handle );
      60           0 :     }
      61             : 
      62             : 
      63        1048 :     inline Pipe::~Pipe()
      64             :     {
      65        1048 :         if( m_handle )
      66         614 :             osl_releasePipe( m_handle );
      67        1048 :     }
      68             : 
      69             : 
      70         124 :     inline bool Pipe::create( const ::rtl::OUString & strName,
      71             :                                   oslPipeOptions Options, const Security &rSec )
      72             :     {
      73         124 :         *this = Pipe( strName, Options, rSec );
      74         124 :         return is();
      75             :     }
      76             : 
      77             : 
      78             :     inline bool Pipe::create( const ::rtl::OUString & strName, oslPipeOptions Options  )
      79             :     {
      80             :         *this = Pipe( strName, Options );
      81             :         return is();
      82             :     }
      83             : 
      84         620 :     inline Pipe& SAL_CALL Pipe::operator= (const Pipe& pipe)
      85             :     {
      86         620 :         *this = pipe.getHandle();
      87         620 :         return *this;
      88             :     }
      89             : 
      90             : 
      91         620 :     inline Pipe & SAL_CALL Pipe::operator=( oslPipe pipe)
      92             :     {
      93         620 :         if( pipe )
      94         435 :             osl_acquirePipe( pipe );
      95         620 :         if( m_handle )
      96           0 :             osl_releasePipe( m_handle );
      97         620 :         m_handle = pipe;
      98         620 :         return *this;
      99             :     }
     100             : 
     101             : 
     102         620 :     inline bool SAL_CALL Pipe::is() const
     103             :     {
     104         620 :         return m_handle != 0;
     105             :     }
     106             : 
     107             : 
     108             :     inline bool SAL_CALL Pipe::operator==( const Pipe& rPipe ) const
     109             :     {
     110             :         return m_handle == rPipe.m_handle;
     111             :     }
     112             : 
     113             : 
     114         361 :     inline void SAL_CALL Pipe::close()
     115             :     {
     116         361 :         osl_closePipe( m_handle );
     117         361 :     }
     118             : 
     119             : 
     120          63 :     inline void SAL_CALL Pipe::clear()
     121             :     {
     122          63 :         if( m_handle )
     123             :         {
     124          63 :             osl_releasePipe( m_handle );
     125          63 :             m_handle = 0;
     126             :         }
     127          63 :     }
     128             : 
     129             : 
     130         242 :     inline oslPipeError SAL_CALL Pipe::accept(StreamPipe& Connection)
     131             :     {
     132         242 :         Connection = StreamPipe( osl_acceptPipe( m_handle ), SAL_NO_ACQUIRE);
     133         242 :         if( Connection.is() )
     134          64 :             return osl_Pipe_E_None;
     135             :         else
     136         178 :             return getError();
     137             :     }
     138             : 
     139             : 
     140         185 :     inline oslPipeError SAL_CALL Pipe::getError() const
     141             :     {
     142         185 :         return osl_getLastPipeError( 0 );
     143             :     }
     144             : 
     145             : 
     146         620 :     inline oslPipe SAL_CALL Pipe::getHandle() const
     147             :     {
     148         620 :         return m_handle;
     149             :     }
     150             : 
     151             : 
     152         251 :     inline StreamPipe::StreamPipe(){}
     153             : 
     154             : 
     155           0 :     inline StreamPipe::StreamPipe(oslPipe hPipe)
     156           0 :         : Pipe( hPipe )
     157             :     {
     158           0 :     }
     159             : 
     160             : 
     161             :     inline StreamPipe::StreamPipe(const ::rtl::OUString& strName, oslPipeOptions Options, const Security &rSec )
     162             :         : Pipe( strName, Options , rSec )
     163             :     {}
     164             : 
     165             : 
     166             :     inline StreamPipe::StreamPipe(const ::rtl::OUString& strName, oslPipeOptions Options  )
     167             :         : Pipe( strName, Options )
     168             :     {}
     169             : 
     170             : 
     171             :     inline StreamPipe::StreamPipe(const StreamPipe& aPipe)
     172             :         : Pipe( aPipe )
     173             :     {}
     174             : 
     175         242 :     inline StreamPipe::StreamPipe( oslPipe pipe, __sal_NoAcquire noacquire )
     176         242 :         : Pipe( pipe , noacquire )
     177         242 :     {}
     178             : 
     179             : 
     180      533956 :     inline sal_Int32 SAL_CALL StreamPipe::read(void* pBuffer, sal_Int32 n) const
     181             :     {
     182      533956 :         return osl_readPipe( m_handle, pBuffer, n );
     183             :     }
     184             : 
     185             : 
     186      219414 :     inline sal_Int32 SAL_CALL StreamPipe::write(const void* pBuffer, sal_Int32 n) const
     187             :     {
     188      219414 :         return osl_writePipe( m_handle, pBuffer , n );
     189             :     }
     190             : 
     191             : 
     192           0 :     inline sal_Int32 SAL_CALL StreamPipe::recv(void* pBuffer, sal_Int32 BytesToRead) const
     193             :     {
     194           0 :         return osl_receivePipe( m_handle, pBuffer , BytesToRead );
     195             :     }
     196             : 
     197             : 
     198             :     inline sal_Int32 SAL_CALL StreamPipe::send(const void* pBuffer, sal_Int32 BytesToSend) const
     199             :     {
     200             :         return osl_sendPipe( m_handle, pBuffer , BytesToSend );
     201             :     }
     202             : 
     203             : }
     204             : #endif
     205             : 
     206             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11