LCOV - code coverage report
Current view: top level - include/tools - zcodec.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 5 0.0 %
Date: 2014-04-14 Functions: 0 4 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             : #ifndef INCLUDED_TOOLS_ZCODEC_HXX
      21             : #define INCLUDED_TOOLS_ZCODEC_HXX
      22             : 
      23             : #include <tools/toolsdllapi.h>
      24             : 
      25             : // Defines
      26             : 
      27             : #define DEFAULT_IN_BUFSIZE          (0x00008000UL)
      28             : #define DEFAULT_OUT_BUFSIZE         (0x00008000UL)
      29             : 
      30             : #define MAX_MEM_USAGE 8
      31             : 
      32             : // memory requirement using compress:
      33             : //  [ INBUFFER ] + [ OUTBUFFER ] + 128KB + 1 << (MEM_USAGE+9)
      34             : // memory requirement using decompress:
      35             : //  [ INBUFFER ] + [ OUTBUFFER ] + 32KB
      36             : 
      37             : #define ZCODEC_NO_COMPRESSION       (0x00000000UL)
      38             : #define ZCODEC_BEST_SPEED           (0x00000001UL)
      39             : #define ZCODEC_DEFAULT_COMPRESSION  (0x00000006UL)
      40             : #define ZCODEC_BEST_COMPRESSION     (0x00000009UL)
      41             : 
      42             : #define ZCODEC_DEFAULT_STRATEGY     (0x00000000UL)
      43             : #define ZCODEC_ZFILTERED            (0x00000100UL)
      44             : #define ZCODEC_ZHUFFMAN_ONLY        (0x00000200UL)
      45             : 
      46             : #define ZCODEC_UPDATE_CRC           (0x00010000UL)
      47             : #define ZCODEC_GZ_LIB               (0x00020000UL)
      48             : 
      49             : #define ZCODEC_PNG_DEFAULT ( ZCODEC_NO_COMPRESSION | ZCODEC_DEFAULT_STRATEGY | ZCODEC_UPDATE_CRC )
      50             : #define ZCODEC_DEFAULT  ( ZCODEC_DEFAULT_COMPRESSION | ZCODEC_DEFAULT_STRATEGY )
      51             : 
      52             : class SvStream;
      53             : 
      54             : class TOOLS_DLLPUBLIC ZCodec
      55             : {
      56             : private:
      57             :     sal_uIntPtr     mbInit;
      58             :     bool            mbStatus;
      59             :     bool            mbFinish;
      60             :     sal_uIntPtr     mnMemUsage;
      61             :     SvStream*       mpIStm;
      62             :     sal_uInt8*      mpInBuf;
      63             :     sal_uIntPtr     mnInBufSize;
      64             :     sal_uIntPtr     mnInToRead;
      65             :     SvStream*       mpOStm;
      66             :     sal_uInt8*      mpOutBuf;
      67             :     sal_uIntPtr     mnOutBufSize;
      68             : 
      69             :     sal_uIntPtr     mnCRC;
      70             :     sal_uIntPtr     mnCompressMethod;
      71             :     void*           mpsC_Stream;
      72             : 
      73             :     void            ImplInitBuf( bool nIOFlag );
      74             :     void            ImplWriteBack( void );
      75             : 
      76             : public:
      77             :                     ZCodec( sal_uIntPtr nInBuf, sal_uIntPtr nOutBuf, sal_uIntPtr nMemUsage = MAX_MEM_USAGE );
      78             :                     ZCodec( void );
      79             :     virtual         ~ZCodec();
      80             : 
      81             :     virtual void    BeginCompression( sal_uIntPtr nCompressMethod = ZCODEC_DEFAULT );
      82             :     virtual long    EndCompression();
      83             :     bool            IsFinished () const { return mbFinish; }
      84             : 
      85             :     long            Compress( SvStream& rIStm, SvStream& rOStm );
      86             :     long            Decompress( SvStream& rIStm, SvStream& rOStm );
      87             : 
      88             :     long            Write( SvStream& rOStm, const sal_uInt8* pData, sal_uIntPtr nSize );
      89             :     long            Read( SvStream& rIStm, sal_uInt8* pData, sal_uIntPtr nSize );
      90             :     long            ReadAsynchron( SvStream& rIStm, sal_uInt8* pData, sal_uIntPtr nSize );
      91             : 
      92             :     void            SetBreak( sal_uIntPtr );
      93             :     sal_uIntPtr     GetBreak( void );
      94             :     void            SetCRC( sal_uIntPtr nCurrentCRC );
      95             :     sal_uIntPtr     UpdateCRC( sal_uIntPtr nLatestCRC, sal_uInt8* pSource, long nDatSize );
      96             :     sal_uIntPtr     GetCRC();
      97             : };
      98             : 
      99             : class GZCodec : public ZCodec
     100             : {
     101             : public:
     102           0 :                     GZCodec(){};
     103           0 :                     virtual ~GZCodec(){};
     104           0 :     virtual void    BeginCompression( sal_uIntPtr nCompressMethod = ZCODEC_DEFAULT ) SAL_OVERRIDE
     105             :     {
     106           0 :         ZCodec::BeginCompression( nCompressMethod | ZCODEC_GZ_LIB );
     107           0 :     };
     108             : };
     109             : 
     110             : #endif
     111             : 
     112             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10