LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/rtl - byteseq.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 41 55 74.5 %
Date: 2012-12-27 Functions: 11 14 78.6 %
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 _RTL_BYTESEQ_HXX_
      20             : #define _RTL_BYTESEQ_HXX_
      21             : 
      22             : #include <osl/interlck.h>
      23             : #include <rtl/byteseq.h>
      24             : #include <rtl/alloc.h>
      25             : 
      26             : #if ! defined EXCEPTIONS_OFF
      27             : #include <new>
      28             : #endif
      29             : 
      30             : 
      31             : namespace rtl
      32             : {
      33             : 
      34             : //__________________________________________________________________________________________________
      35         772 : inline ByteSequence::ByteSequence() SAL_THROW(())
      36         772 :     : _pSequence( 0 )
      37             : {
      38         772 :     ::rtl_byte_sequence_construct( &_pSequence, 0 );
      39         772 : }
      40             : //__________________________________________________________________________________________________
      41           2 : inline ByteSequence::ByteSequence( const ByteSequence & rSeq ) SAL_THROW(())
      42           2 :     : _pSequence( 0 )
      43             : {
      44           2 :     ::rtl_byte_sequence_assign( &_pSequence, rSeq._pSequence );
      45           2 : }
      46             : //__________________________________________________________________________________________________
      47           1 : inline ByteSequence::ByteSequence( sal_Sequence *pSequence) SAL_THROW(())
      48           1 :     : _pSequence( pSequence )
      49             : {
      50           1 :     ::rtl_byte_sequence_acquire( pSequence );
      51           1 : }
      52             : //__________________________________________________________________________________________________
      53        1366 : inline ByteSequence::ByteSequence( const sal_Int8 * pElements, sal_Int32 len )
      54        1366 :     : _pSequence( 0 )
      55             : {
      56        1366 :     ::rtl_byte_sequence_constructFromArray( &_pSequence, pElements, len );
      57             : #if ! defined EXCEPTIONS_OFF
      58        1366 :     if (_pSequence == 0)
      59           0 :         throw ::std::bad_alloc();
      60             : #endif
      61        1366 : }
      62             : //__________________________________________________________________________________________________
      63           2 : inline ByteSequence::ByteSequence( sal_Int32 len, enum __ByteSequence_NoDefault )
      64           2 :     : _pSequence( 0 )
      65             : {
      66           2 :     ::rtl_byte_sequence_constructNoDefault( &_pSequence, len );
      67             : #if ! defined EXCEPTIONS_OFF
      68           2 :     if (_pSequence == 0)
      69           0 :         throw ::std::bad_alloc();
      70             : #endif
      71           2 : }
      72             : //__________________________________________________________________________________________________
      73           1 : inline ByteSequence::ByteSequence( sal_Sequence *pSequence, enum __ByteSequence_NoAcquire ) SAL_THROW(())
      74           1 :     : _pSequence( pSequence )
      75             : {
      76           1 : }
      77             : //__________________________________________________________________________________________________
      78           3 : inline ByteSequence::ByteSequence( sal_Int32 len )
      79           3 :     : _pSequence( 0 )
      80             : {
      81           3 :     ::rtl_byte_sequence_construct( &_pSequence, len );
      82             : #if ! defined EXCEPTIONS_OFF
      83           3 :     if (_pSequence == 0)
      84           0 :         throw ::std::bad_alloc();
      85             : #endif
      86           3 : }
      87             : //__________________________________________________________________________________________________
      88        2147 : inline ByteSequence::~ByteSequence() SAL_THROW(())
      89             : {
      90        2147 :     ::rtl_byte_sequence_release( _pSequence );
      91        2147 : }
      92             : //__________________________________________________________________________________________________
      93           0 : inline ByteSequence & ByteSequence::operator = ( const ByteSequence & rSeq ) SAL_THROW(())
      94             : {
      95           0 :     ::rtl_byte_sequence_assign( &_pSequence, rSeq._pSequence );
      96           0 :     return *this;
      97             : }
      98             : //__________________________________________________________________________________________________
      99          12 : inline sal_Bool ByteSequence::operator == ( const ByteSequence & rSeq ) const SAL_THROW(())
     100             : {
     101          12 :     return ::rtl_byte_sequence_equals( _pSequence, rSeq._pSequence );
     102             : }
     103             : //__________________________________________________________________________________________________
     104           1 : inline sal_Int8 * ByteSequence::getArray()
     105             : {
     106           1 :     ::rtl_byte_sequence_reference2One( &_pSequence );
     107             : #if ! defined EXCEPTIONS_OFF
     108           1 :     if (_pSequence == 0)
     109           0 :         throw ::std::bad_alloc();
     110             : #endif
     111           1 :     return (sal_Int8 *)_pSequence->elements;
     112             : }
     113             : //__________________________________________________________________________________________________
     114           0 : inline void ByteSequence::realloc( sal_Int32 nSize )
     115             : {
     116           0 :     ::rtl_byte_sequence_realloc( &_pSequence, nSize );
     117             : #if ! defined EXCEPTIONS_OFF
     118           0 :     if (_pSequence == 0)
     119           0 :         throw ::std::bad_alloc();
     120             : #endif
     121           0 : }
     122             : //__________________________________________________________________________________________________
     123           0 : inline sal_Int8 & ByteSequence::operator [] ( sal_Int32 nIndex )
     124             : {
     125           0 :     return getArray()[ nIndex ];
     126             : }
     127             : //__________________________________________________________________________________________________
     128           6 : inline sal_Bool ByteSequence::operator != ( const ByteSequence & rSeq ) const SAL_THROW(())
     129             : {
     130           6 :     return (! operator == ( rSeq ));
     131             : }
     132             : 
     133             : }
     134             : #endif
     135             : 
     136             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10