LCOV - code coverage report
Current view: top level - package/source/zipapi - ByteChucker.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 31 44 70.5 %
Date: 2014-11-03 Functions: 7 10 70.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             : 
      20             : #include <ByteChucker.hxx>
      21             : #include <PackageConstants.hxx>
      22             : #include <com/sun/star/io/XSeekable.hpp>
      23             : #include <com/sun/star/io/XOutputStream.hpp>
      24             : 
      25             : using namespace ::com::sun::star::io;
      26             : using namespace ::com::sun::star::uno;
      27             : using namespace ::com::sun::star::lang;
      28             : 
      29        1334 : ByteChucker::ByteChucker(Reference<XOutputStream> xOstream)
      30             : : xStream(xOstream)
      31             : , xSeek (xOstream, UNO_QUERY )
      32             : , a1Sequence ( 1 )
      33             : , a2Sequence ( 2 )
      34             : , a4Sequence ( 4 )
      35        1334 : , p1Sequence ( a1Sequence.getArray() )
      36        1334 : , p2Sequence ( a2Sequence.getArray() )
      37        4002 : , p4Sequence ( a4Sequence.getArray() )
      38             : {
      39        1334 : }
      40             : 
      41        1334 : ByteChucker::~ByteChucker()
      42             : {
      43        1334 : }
      44             : 
      45      636182 : void ByteChucker::WriteBytes( const Sequence< sal_Int8 >& aData )
      46             :     throw(NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
      47             : {
      48      636182 :     xStream->writeBytes(aData);
      49      636182 : }
      50             : 
      51       21832 : sal_Int64 ByteChucker::GetPosition(  )
      52             :         throw(IOException, RuntimeException)
      53             : {
      54       21832 :     return xSeek->getPosition();
      55             : }
      56             : 
      57           0 : ByteChucker& ByteChucker::operator << (sal_Int8 nInt8)
      58             : {
      59           0 :     p1Sequence[0] = nInt8  & 0xFF;
      60           0 :     WriteBytes( a1Sequence );
      61           0 :     return *this;
      62             : }
      63             : 
      64      274966 : ByteChucker& ByteChucker::operator << (sal_Int16 nInt16)
      65             : {
      66      274966 :     p2Sequence[0] = static_cast< sal_Int8 >((nInt16 >>  0 ) & 0xFF);
      67      274966 :     p2Sequence[1] = static_cast< sal_Int8 >((nInt16 >>  8 ) & 0xFF);
      68      274966 :     WriteBytes( a2Sequence );
      69      274966 :     return *this;
      70             : }
      71      129002 : ByteChucker& ByteChucker::operator << (sal_Int32 nInt32)
      72             : {
      73      129002 :     p4Sequence[0] = static_cast< sal_Int8 >((nInt32 >>  0 ) & 0xFF);
      74      129002 :     p4Sequence[1] = static_cast< sal_Int8 >((nInt32 >>  8 ) & 0xFF);
      75      129002 :     p4Sequence[2] = static_cast< sal_Int8 >((nInt32 >> 16 ) & 0xFF);
      76      129002 :     p4Sequence[3] = static_cast< sal_Int8 >((nInt32 >> 24 ) & 0xFF);
      77      129002 :     WriteBytes( a4Sequence );
      78      129002 :     return *this;
      79             : }
      80             : 
      81           0 : ByteChucker& ByteChucker::operator << (sal_uInt8 nuInt8)
      82             : {
      83           0 :     p1Sequence[0] = nuInt8  & 0xFF;
      84           0 :     WriteBytes( a1Sequence );
      85           0 :     return *this;
      86             : }
      87           0 : ByteChucker& ByteChucker::operator << (sal_uInt16 nuInt16)
      88             : {
      89           0 :     p2Sequence[0] = static_cast< sal_Int8 >((nuInt16 >>  0 ) & 0xFF);
      90           0 :     p2Sequence[1] = static_cast< sal_Int8 >((nuInt16 >>  8 ) & 0xFF);
      91           0 :     WriteBytes( a2Sequence );
      92           0 :     return *this;
      93             : }
      94      175144 : ByteChucker& ByteChucker::operator << (sal_uInt32 nuInt32)
      95             : {
      96      175144 :     p4Sequence[0] = static_cast < sal_Int8 > ((nuInt32 >>  0 ) & 0xFF);
      97      175144 :     p4Sequence[1] = static_cast < sal_Int8 > ((nuInt32 >>  8 ) & 0xFF);
      98      175144 :     p4Sequence[2] = static_cast < sal_Int8 > ((nuInt32 >> 16 ) & 0xFF);
      99      175144 :     p4Sequence[3] = static_cast < sal_Int8 > ((nuInt32 >> 24 ) & 0xFF);
     100      175144 :     WriteBytes( a4Sequence );
     101      175144 :     return *this;
     102             : }
     103             : 
     104             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10