LCOV - code coverage report
Current view: top level - package/source/zipapi - ByteChucker.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 44 0.0 %
Date: 2014-04-14 Functions: 0 10 0.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           0 : ByteChucker::ByteChucker(Reference<XOutputStream> xOstream)
      30             : : xStream(xOstream)
      31             : , xSeek (xOstream, UNO_QUERY )
      32             : , a1Sequence ( 1 )
      33             : , a2Sequence ( 2 )
      34             : , a4Sequence ( 4 )
      35           0 : , p1Sequence ( a1Sequence.getArray() )
      36           0 : , p2Sequence ( a2Sequence.getArray() )
      37           0 : , p4Sequence ( a4Sequence.getArray() )
      38             : {
      39           0 : }
      40             : 
      41           0 : ByteChucker::~ByteChucker()
      42             : {
      43           0 : }
      44             : 
      45           0 : void ByteChucker::WriteBytes( const Sequence< sal_Int8 >& aData )
      46             :     throw(NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
      47             : {
      48           0 :     xStream->writeBytes(aData);
      49           0 : }
      50             : 
      51           0 : sal_Int64 ByteChucker::GetPosition(  )
      52             :         throw(IOException, RuntimeException)
      53             : {
      54           0 :     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           0 : ByteChucker& ByteChucker::operator << (sal_Int16 nInt16)
      65             : {
      66           0 :     p2Sequence[0] = static_cast< sal_Int8 >((nInt16 >>  0 ) & 0xFF);
      67           0 :     p2Sequence[1] = static_cast< sal_Int8 >((nInt16 >>  8 ) & 0xFF);
      68           0 :     WriteBytes( a2Sequence );
      69           0 :     return *this;
      70             : }
      71           0 : ByteChucker& ByteChucker::operator << (sal_Int32 nInt32)
      72             : {
      73           0 :     p4Sequence[0] = static_cast< sal_Int8 >((nInt32 >>  0 ) & 0xFF);
      74           0 :     p4Sequence[1] = static_cast< sal_Int8 >((nInt32 >>  8 ) & 0xFF);
      75           0 :     p4Sequence[2] = static_cast< sal_Int8 >((nInt32 >> 16 ) & 0xFF);
      76           0 :     p4Sequence[3] = static_cast< sal_Int8 >((nInt32 >> 24 ) & 0xFF);
      77           0 :     WriteBytes( a4Sequence );
      78           0 :     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           0 : ByteChucker& ByteChucker::operator << (sal_uInt32 nuInt32)
      95             : {
      96           0 :     p4Sequence[0] = static_cast < sal_Int8 > ((nuInt32 >>  0 ) & 0xFF);
      97           0 :     p4Sequence[1] = static_cast < sal_Int8 > ((nuInt32 >>  8 ) & 0xFF);
      98           0 :     p4Sequence[2] = static_cast < sal_Int8 > ((nuInt32 >> 16 ) & 0xFF);
      99           0 :     p4Sequence[3] = static_cast < sal_Int8 > ((nuInt32 >> 24 ) & 0xFF);
     100           0 :     WriteBytes( a4Sequence );
     101           0 :     return *this;
     102             : }
     103             : 
     104             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10