/* ========================================================================== * ÀÛ ¼º ÀÚ : À̼ø±Ô * ÀÛ ¼º ÀÏ : 2007.06.20 * ³» ¿ë : * ÁÖÀÇ»çÇ× : *===========================================================================*/ #pragma once #include "zlib.h" class cFileUnzipper { public: cFileUnzipper(); ~cFileUnzipper(); /// ¿­±â bool Open( const cString& pathName ); /// ´Ý±â void Close(); /// µ¥ÀÌŸ Àбâ /// ½ÇÁ¦·Î ÀÐÀº ¾ÐÃàÇØÁ¦µÈ µ¥ÀÌŸ Å©±â¸¦ ¸®ÅÏÇÑ´Ù. /// ÆÄÀÏ ³¡¿¡ µµ´ÞÇϸé 0, ½ÇÆÐÇϸé -1À» ¸®ÅÏÇÑ´Ù. int Read( void* buffer, unsigned bufferSize ); private: gzFile mZipFile; }; inline cFileUnzipper::cFileUnzipper() : mZipFile( 0 ) { } inline cFileUnzipper::~cFileUnzipper() { Close(); } inline bool cFileUnzipper::Open( const cString& pathName ) { assert( mZipFile == 0 ); mZipFile = gzopen( pathName.Cstr(), "rb" ); return mZipFile != 0; } inline void cFileUnzipper::Close() { if( mZipFile ) { gzclose( mZipFile ); mZipFile = 0; } } inline int cFileUnzipper::Read( void* buffer, unsigned bufferSize ) { assert( mZipFile ); if( mZipFile ) return gzread( mZipFile, buffer, bufferSize ); else return 0; }