misc/quazip/ioapi.h
changeset 8057 93e16240f178
parent 8051 f26422ef0333
parent 8055 04dd8b7fb605
child 8058 bcebfc477459
equal deleted inserted replaced
8051:f26422ef0333 8057:93e16240f178
     1 /* ioapi.h -- IO base function header for compress/uncompress .zip
       
     2    files using zlib + zip or unzip API
       
     3 
       
     4    Version 1.01e, February 12th, 2005
       
     5 
       
     6    Copyright (C) 1998-2005 Gilles Vollant
       
     7 
       
     8    Modified by Sergey A. Tachenov to integrate with Qt.
       
     9 */
       
    10 
       
    11 #ifndef _ZLIBIOAPI_H
       
    12 #define _ZLIBIOAPI_H
       
    13 
       
    14 
       
    15 #define ZLIB_FILEFUNC_SEEK_CUR (1)
       
    16 #define ZLIB_FILEFUNC_SEEK_END (2)
       
    17 #define ZLIB_FILEFUNC_SEEK_SET (0)
       
    18 
       
    19 #define ZLIB_FILEFUNC_MODE_READ      (1)
       
    20 #define ZLIB_FILEFUNC_MODE_WRITE     (2)
       
    21 #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
       
    22 
       
    23 #define ZLIB_FILEFUNC_MODE_EXISTING (4)
       
    24 #define ZLIB_FILEFUNC_MODE_CREATE   (8)
       
    25 
       
    26 
       
    27 #ifndef ZCALLBACK
       
    28 
       
    29 #if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
       
    30 #define ZCALLBACK CALLBACK
       
    31 #else
       
    32 #define ZCALLBACK
       
    33 #endif
       
    34 #endif
       
    35 
       
    36 #ifdef __cplusplus
       
    37 extern "C" {
       
    38 #endif
       
    39 
       
    40 typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, voidpf file, int mode));
       
    41 typedef uLong  (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
       
    42 typedef uLong  (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
       
    43 typedef uLong   (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
       
    44 typedef int   (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
       
    45 typedef int    (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
       
    46 typedef int    (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
       
    47 
       
    48 typedef struct zlib_filefunc_def_s
       
    49 {
       
    50     open_file_func      zopen_file;
       
    51     read_file_func      zread_file;
       
    52     write_file_func     zwrite_file;
       
    53     tell_file_func      ztell_file;
       
    54     seek_file_func      zseek_file;
       
    55     close_file_func     zclose_file;
       
    56     testerror_file_func zerror_file;
       
    57     voidpf              opaque;
       
    58 } zlib_filefunc_def;
       
    59 
       
    60 
       
    61 
       
    62 void fill_qiodevice_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
       
    63 
       
    64 #define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size))
       
    65 #define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size))
       
    66 #define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream))
       
    67 #define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode))
       
    68 #define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream))
       
    69 #define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream))
       
    70 
       
    71 
       
    72 #ifdef __cplusplus
       
    73 }
       
    74 #endif
       
    75 
       
    76 #endif
       
    77