00001 /****************************************************************************** 00002 * swcomprs.h - definition of Class SWCompress used for data compression 00003 * 00004 * $Id: swcomprs_8h-source.html,v 1.9 2002/10/31 11:30:16 joachim Exp $ 00005 * 00006 * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org) 00007 * CrossWire Bible Society 00008 * P. O. Box 2528 00009 * Tempe, AZ 85280-2528 00010 * 00011 * This program is free software; you can redistribute it and/or modify it 00012 * under the terms of the GNU General Public License as published by the 00013 * Free Software Foundation version 2. 00014 * 00015 * This program is distributed in the hope that it will be useful, but 00016 * WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * General Public License for more details. 00019 * 00020 */ 00021 00022 #ifndef SWCOMPRS_H 00023 #define SWCOMPRS_H 00024 00025 #include <defs.h> 00026 00027 SWORD_NAMESPACE_START 00028 00029 class SWDLLEXPORT SWCompress 00030 { 00031 void Init (); 00032 void cycleStream (); 00033 protected: 00034 char *buf, *zbuf, direct; // 0 - encode; 1 - decode 00035 unsigned long zlen, zpos, pos, slen; 00036 public: 00037 SWCompress (); 00038 virtual ~ SWCompress (); 00039 virtual char *Buf (const char *buf = 0, unsigned long *len = 0); 00040 virtual char *zBuf (unsigned long *len, char *buf = 0); 00041 virtual unsigned long GetChars (char *buf, unsigned long len); // override for other than buffer compression 00042 virtual unsigned long SendChars (char *buf, unsigned long len); // override for other than buffer compression 00043 virtual void Encode (void); // override to provide compression algorythm 00044 virtual void Decode (void); // override to provide compression algorythm 00045 }; 00046 00047 SWORD_NAMESPACE_END 00048 #endif