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

Generated by: LCOV version 1.10