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: 48 55 87.3 %
Date: 2012-12-17 Functions: 13 14 92.9 %
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        6937 : inline ByteSequence::ByteSequence() SAL_THROW(())
      36        6937 :     : _pSequence( 0 )
      37             : {
      38        6937 :     ::rtl_byte_sequence_construct( &_pSequence, 0 );
      39        6937 : }
      40             : //__________________________________________________________________________________________________
      41       11329 : inline ByteSequence::ByteSequence( const ByteSequence & rSeq ) SAL_THROW(())
      42       11329 :     : _pSequence( 0 )
      43             : {
      44       11329 :     ::rtl_byte_sequence_assign( &_pSequence, rSeq._pSequence );
      45       11329 : }
      46             : //__________________________________________________________________________________________________
      47        2533 : inline ByteSequence::ByteSequence( sal_Sequence *pSequence) SAL_THROW(())
      48        2533 :     : _pSequence( pSequence )
      49             : {
      50        2533 :     ::rtl_byte_sequence_acquire( pSequence );
      51        2533 : }
      52             : //__________________________________________________________________________________________________
      53        2974 : inline ByteSequence::ByteSequence( const sal_Int8 * pElements, sal_Int32 len )
      54        2974 :     : _pSequence( 0 )
      55             : {
      56        2974 :     ::rtl_byte_sequence_constructFromArray( &_pSequence, pElements, len );
      57             : #if ! defined EXCEPTIONS_OFF
      58        2974 :     if (_pSequence == 0)
      59           0 :         throw ::std::bad_alloc();
      60             : #endif
      61        2974 : }
      62             : //__________________________________________________________________________________________________
      63           4 : inline ByteSequence::ByteSequence( sal_Int32 len, enum __ByteSequence_NoDefault )
      64           4 :     : _pSequence( 0 )
      65             : {
      66           4 :     ::rtl_byte_sequence_constructNoDefault( &_pSequence, len );
      67             : #if ! defined EXCEPTIONS_OFF
      68           4 :     if (_pSequence == 0)
      69           0 :         throw ::std::bad_alloc();
      70             : #endif
      71           4 : }
      72             : //__________________________________________________________________________________________________
      73           2 : inline ByteSequence::ByteSequence( sal_Sequence *pSequence, enum __ByteSequence_NoAcquire ) SAL_THROW(())
      74           2 :     : _pSequence( pSequence )
      75             : {
      76           2 : }
      77             : //__________________________________________________________________________________________________
      78           6 : inline ByteSequence::ByteSequence( sal_Int32 len )
      79           6 :     : _pSequence( 0 )
      80             : {
      81           6 :     ::rtl_byte_sequence_construct( &_pSequence, len );
      82             : #if ! defined EXCEPTIONS_OFF
      83           6 :     if (_pSequence == 0)
      84           0 :         throw ::std::bad_alloc();
      85             : #endif
      86           6 : }
      87             : //__________________________________________________________________________________________________
      88       23785 : inline ByteSequence::~ByteSequence() SAL_THROW(())
      89             : {
      90       23785 :     ::rtl_byte_sequence_release( _pSequence );
      91       23785 : }
      92             : //__________________________________________________________________________________________________
      93        7516 : inline ByteSequence & ByteSequence::operator = ( const ByteSequence & rSeq ) SAL_THROW(())
      94             : {
      95        7516 :     ::rtl_byte_sequence_assign( &_pSequence, rSeq._pSequence );
      96        7516 :     return *this;
      97             : }
      98             : //__________________________________________________________________________________________________
      99        5721 : inline sal_Bool ByteSequence::operator == ( const ByteSequence & rSeq ) const SAL_THROW(())
     100             : {
     101        5721 :     return ::rtl_byte_sequence_equals( _pSequence, rSeq._pSequence );
     102             : }
     103             : //__________________________________________________________________________________________________
     104          18 : inline sal_Int8 * ByteSequence::getArray()
     105             : {
     106          18 :     ::rtl_byte_sequence_reference2One( &_pSequence );
     107             : #if ! defined EXCEPTIONS_OFF
     108          18 :     if (_pSequence == 0)
     109           0 :         throw ::std::bad_alloc();
     110             : #endif
     111          18 :     return (sal_Int8 *)_pSequence->elements;
     112             : }
     113             : //__________________________________________________________________________________________________
     114          16 : inline void ByteSequence::realloc( sal_Int32 nSize )
     115             : {
     116          16 :     ::rtl_byte_sequence_realloc( &_pSequence, nSize );
     117             : #if ! defined EXCEPTIONS_OFF
     118          16 :     if (_pSequence == 0)
     119           0 :         throw ::std::bad_alloc();
     120             : #endif
     121          16 : }
     122             : //__________________________________________________________________________________________________
     123           0 : inline sal_Int8 & ByteSequence::operator [] ( sal_Int32 nIndex )
     124             : {
     125           0 :     return getArray()[ nIndex ];
     126             : }
     127             : //__________________________________________________________________________________________________
     128        1894 : inline sal_Bool ByteSequence::operator != ( const ByteSequence & rSeq ) const SAL_THROW(())
     129             : {
     130        1894 :     return (! operator == ( rSeq ));
     131             : }
     132             : 
     133             : }
     134             : #endif
     135             : 
     136             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10