LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/rtl - byteseq.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 50 55 90.9 %
Date: 2013-07-09 Functions: 14 14 100.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 _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      237845 : inline ByteSequence::ByteSequence() SAL_THROW(())
      36      237845 :     : _pSequence( 0 )
      37             : {
      38      237845 :     ::rtl_byte_sequence_construct( &_pSequence, 0 );
      39      237843 : }
      40             : //__________________________________________________________________________________________________
      41     1261503 : inline ByteSequence::ByteSequence( const ByteSequence & rSeq ) SAL_THROW(())
      42     1261503 :     : _pSequence( 0 )
      43             : {
      44     1261503 :     ::rtl_byte_sequence_assign( &_pSequence, rSeq._pSequence );
      45     1261503 : }
      46             : //__________________________________________________________________________________________________
      47      318093 : inline ByteSequence::ByteSequence( sal_Sequence *pSequence) SAL_THROW(())
      48      318093 :     : _pSequence( pSequence )
      49             : {
      50      318093 :     ::rtl_byte_sequence_acquire( pSequence );
      51      318093 : }
      52             : //__________________________________________________________________________________________________
      53        4616 : inline ByteSequence::ByteSequence( const sal_Int8 * pElements, sal_Int32 len )
      54        4616 :     : _pSequence( 0 )
      55             : {
      56        4616 :     ::rtl_byte_sequence_constructFromArray( &_pSequence, pElements, len );
      57             : #if ! defined EXCEPTIONS_OFF
      58        4616 :     if (_pSequence == 0)
      59           0 :         throw ::std::bad_alloc();
      60             : #endif
      61        4616 : }
      62             : //__________________________________________________________________________________________________
      63          98 : inline ByteSequence::ByteSequence( sal_Int32 len, enum __ByteSequence_NoDefault )
      64          98 :     : _pSequence( 0 )
      65             : {
      66          98 :     ::rtl_byte_sequence_constructNoDefault( &_pSequence, len );
      67             : #if ! defined EXCEPTIONS_OFF
      68          98 :     if (_pSequence == 0)
      69           0 :         throw ::std::bad_alloc();
      70             : #endif
      71          98 : }
      72             : //__________________________________________________________________________________________________
      73       11815 : inline ByteSequence::ByteSequence( sal_Sequence *pSequence, enum __ByteSequence_NoAcquire ) SAL_THROW(())
      74       11815 :     : _pSequence( pSequence )
      75             : {
      76       11815 : }
      77             : //__________________________________________________________________________________________________
      78          97 : inline ByteSequence::ByteSequence( sal_Int32 len )
      79          97 :     : _pSequence( 0 )
      80             : {
      81          97 :     ::rtl_byte_sequence_construct( &_pSequence, len );
      82             : #if ! defined EXCEPTIONS_OFF
      83          97 :     if (_pSequence == 0)
      84           0 :         throw ::std::bad_alloc();
      85             : #endif
      86          97 : }
      87             : //__________________________________________________________________________________________________
      88     1833795 : inline ByteSequence::~ByteSequence() SAL_THROW(())
      89             : {
      90     1833795 :     ::rtl_byte_sequence_release( _pSequence );
      91     1833794 : }
      92             : //__________________________________________________________________________________________________
      93      830750 : inline ByteSequence & ByteSequence::operator = ( const ByteSequence & rSeq ) SAL_THROW(())
      94             : {
      95      830750 :     ::rtl_byte_sequence_assign( &_pSequence, rSeq._pSequence );
      96      830750 :     return *this;
      97             : }
      98             : //__________________________________________________________________________________________________
      99      694777 : inline sal_Bool ByteSequence::operator == ( const ByteSequence & rSeq ) const SAL_THROW(())
     100             : {
     101      694777 :     return ::rtl_byte_sequence_equals( _pSequence, rSeq._pSequence );
     102             : }
     103             : //__________________________________________________________________________________________________
     104        3937 : inline sal_Int8 * ByteSequence::getArray()
     105             : {
     106        3937 :     ::rtl_byte_sequence_reference2One( &_pSequence );
     107             : #if ! defined EXCEPTIONS_OFF
     108        3937 :     if (_pSequence == 0)
     109           0 :         throw ::std::bad_alloc();
     110             : #endif
     111        3937 :     return (sal_Int8 *)_pSequence->elements;
     112             : }
     113             : //__________________________________________________________________________________________________
     114        1001 : inline void ByteSequence::realloc( sal_Int32 nSize )
     115             : {
     116        1001 :     ::rtl_byte_sequence_realloc( &_pSequence, nSize );
     117             : #if ! defined EXCEPTIONS_OFF
     118        1001 :     if (_pSequence == 0)
     119           0 :         throw ::std::bad_alloc();
     120             : #endif
     121        1001 : }
     122             : //__________________________________________________________________________________________________
     123        1349 : inline sal_Int8 & ByteSequence::operator [] ( sal_Int32 nIndex )
     124             : {
     125        1349 :     return getArray()[ nIndex ];
     126             : }
     127             : //__________________________________________________________________________________________________
     128      206006 : inline sal_Bool ByteSequence::operator != ( const ByteSequence & rSeq ) const SAL_THROW(())
     129             : {
     130      206006 :     return (! operator == ( rSeq ));
     131             : }
     132             : 
     133             : }
     134             : #endif
     135             : 
     136             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10