LCOV - code coverage report
Current view: top level - include/rtl - byteseq.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 50 55 90.9 %
Date: 2014-04-11 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 INCLUDED_RTL_BYTESEQ_HXX
      20             : #define INCLUDED_RTL_BYTESEQ_HXX
      21             : 
      22             : #include <osl/interlck.h>
      23             : #include <rtl/byteseq.h>
      24             : #include <rtl/alloc.h>
      25             : 
      26             : #include <new>
      27             : 
      28             : namespace rtl
      29             : {
      30             : 
      31             : 
      32      234688 : inline ByteSequence::ByteSequence() SAL_THROW(())
      33      234688 :     : _pSequence( 0 )
      34             : {
      35      234688 :     ::rtl_byte_sequence_construct( &_pSequence, 0 );
      36      234688 : }
      37             : 
      38     1322993 : inline ByteSequence::ByteSequence( const ByteSequence & rSeq ) SAL_THROW(())
      39     1322993 :     : _pSequence( 0 )
      40             : {
      41     1322993 :     ::rtl_byte_sequence_assign( &_pSequence, rSeq._pSequence );
      42     1322994 : }
      43             : 
      44      326565 : inline ByteSequence::ByteSequence( sal_Sequence *pSequence) SAL_THROW(())
      45      326565 :     : _pSequence( pSequence )
      46             : {
      47      326565 :     ::rtl_byte_sequence_acquire( pSequence );
      48      326565 : }
      49             : 
      50       19005 : inline ByteSequence::ByteSequence( const sal_Int8 * pElements, sal_Int32 len )
      51       19005 :     : _pSequence( 0 )
      52             : {
      53       19005 :     ::rtl_byte_sequence_constructFromArray( &_pSequence, pElements, len );
      54       19005 :     if (_pSequence == 0)
      55           0 :         throw ::std::bad_alloc();
      56       19005 : }
      57             : 
      58           2 : inline ByteSequence::ByteSequence( sal_Int32 len, enum __ByteSequence_NoDefault )
      59           2 :     : _pSequence( 0 )
      60             : {
      61           2 :     ::rtl_byte_sequence_constructNoDefault( &_pSequence, len );
      62           2 :     if (_pSequence == 0)
      63           0 :         throw ::std::bad_alloc();
      64           2 : }
      65             : 
      66       11856 : inline ByteSequence::ByteSequence( sal_Sequence *pSequence, enum __ByteSequence_NoAcquire ) SAL_THROW(())
      67       11856 :     : _pSequence( pSequence )
      68             : {
      69       11856 : }
      70             : 
      71         251 : inline ByteSequence::ByteSequence( sal_Int32 len )
      72         251 :     : _pSequence( 0 )
      73             : {
      74         251 :     ::rtl_byte_sequence_construct( &_pSequence, len );
      75         251 :     if (_pSequence == 0)
      76           0 :         throw ::std::bad_alloc();
      77         251 : }
      78             : 
      79     1915088 : inline ByteSequence::~ByteSequence() SAL_THROW(())
      80             : {
      81     1915088 :     ::rtl_byte_sequence_release( _pSequence );
      82     1915086 : }
      83             : 
      84      863464 : inline ByteSequence & ByteSequence::operator = ( const ByteSequence & rSeq ) SAL_THROW(())
      85             : {
      86      863464 :     ::rtl_byte_sequence_assign( &_pSequence, rSeq._pSequence );
      87      863465 :     return *this;
      88             : }
      89             : 
      90      730062 : inline bool ByteSequence::operator == ( const ByteSequence & rSeq ) const SAL_THROW(())
      91             : {
      92      730062 :     return ::rtl_byte_sequence_equals( _pSequence, rSeq._pSequence );
      93             : }
      94             : 
      95        2109 : inline sal_Int8 * ByteSequence::getArray()
      96             : {
      97        2109 :     ::rtl_byte_sequence_reference2One( &_pSequence );
      98        2109 :     if (_pSequence == 0)
      99           0 :         throw ::std::bad_alloc();
     100        2109 :     return (sal_Int8 *)_pSequence->elements;
     101             : }
     102             : 
     103         335 : inline void ByteSequence::realloc( sal_Int32 nSize )
     104             : {
     105         335 :     ::rtl_byte_sequence_realloc( &_pSequence, nSize );
     106         335 :     if (_pSequence == 0)
     107           0 :         throw ::std::bad_alloc();
     108         335 : }
     109             : 
     110        1351 : inline sal_Int8 & ByteSequence::operator [] ( sal_Int32 nIndex )
     111             : {
     112        1351 :     return getArray()[ nIndex ];
     113             : }
     114             : 
     115      207605 : inline bool ByteSequence::operator != ( const ByteSequence & rSeq ) const SAL_THROW(())
     116             : {
     117      207605 :     return (! operator == ( rSeq ));
     118             : }
     119             : 
     120             : }
     121             : #endif
     122             : 
     123             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10