home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2003 November / VPR0311.ISO / OLS / TAR32223 / tar32223.lzh / tar32_2 / src / arcz.h < prev    next >
C/C++ Source or Header  |  2003-01-17  |  2KB  |  75 lines

  1. /*
  2.     arcgz.h
  3.         gzip archive input/output class.
  4.         by Yoshioka Tsuneo(QWF00133@nifty.ne.jp)
  5. */
  6. /*    
  7.     このファイルの利用条件:
  8.         このソースファイルの利用制限は一切ありません。
  9.         ソースの一部、全部を商用、非商用など目的に
  10.         かかわりなく他のプログラムで自由に使用できます。
  11.         パブリック・ドメイン・ソフトウェアと同様に扱えます。
  12.     
  13.     プログラマ向けの要望(制限ではありません):
  14.         ソース中に改善すべき点があればお知らせください。
  15.         ソースコード中にバグを見つけた場合は報告してください。
  16.         直した部分などありましたら教えてください。
  17.         断片的な情報でも結構です。
  18.         このファイルを利用した場合はなるべく教えてください。
  19. */
  20. /*
  21.     LICENSE of this file:
  22.         There is no restriction for using this file.
  23.         You can use this file in your software for any purpose.
  24.         In other words, you can use this file as Public Domain Software.
  25.  
  26.     RECOMMENDATION for Programmer(not restriction):
  27.         If you find points to improve code, please report me.
  28.         If you find bug in source code, please report me.
  29.         If you fixed bug, please teach me.
  30.         I want any trivial information.
  31.         If you use this file, please report me.
  32. */
  33.  
  34. #include "arcfile.h"
  35. #include "tar32api.h" // ARCHIVETYPE_
  36. #include "fast_stl.h"
  37. // #include <sstream>
  38. using namespace std;
  39.  
  40. class CTarArcFile_Compress : public ITarArcFile{
  41. public:
  42.     CTarArcFile_Compress();
  43.     ~CTarArcFile_Compress();
  44.     bool open(const char *arcfile, const char *mode);
  45.     int read(void *buf, int size);
  46.     int write(void *buf, int size){return -1;}
  47.     // int seek(int offset, int origin);
  48.     void close();
  49.     int get_archive_type(){return ARCHIVETYPE_Z;}
  50.     virtual string get_orig_filename();
  51.  
  52.     static const unsigned char MAGIC_1;// = '\037';/* First byte of compressed file    */
  53.     static const unsigned char MAGIC_2;// = '\235';/* Second byte of compressed file    */
  54. private:
  55.       bool readonce();
  56.     FILE *m_pFile;
  57.     int m_maxbits;
  58. #define HSIZE 1 << 17
  59.     // static const int HSIZE;//    = 1<<17;
  60.     unsigned short    m_codetab[HSIZE];
  61.     unsigned char   m_htab[HSIZE];
  62.     unsigned char m_inbuf[BUFSIZ + 64];
  63.     bool m_eof;
  64.     fast_strstream m_strstream;
  65.     int                m_finchar;
  66.     int                m_oldcode;
  67.     int                m_posbits;
  68.     int                m_free_ent;
  69.     int                m_maxcode;
  70.     int                m_n_bits;
  71.     int                m_rsize;
  72.     int                m_insize;
  73.     bool            m_block_mode;
  74. };
  75.