ZipFileDescriptor.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 2003-2006 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED,
00008 //  AS TO THE CORRECTNESS OF THIS CODE OR ANY DERIVATIVE
00009 //  WORKS WHICH INCORPORATE IT.
00010 //
00011 //  AUTODESK PROVIDES THE CODE ON AN "AS-IS" BASIS
00012 //  AND EXPLICITLY DISCLAIMS ANY LIABILITY, INCLUDING
00013 //  CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00014 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00015 //
00016 //  Use, duplication, or disclosure by the U.S. Government is subject to
00017 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00018 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00019 //  Data and Computer Software), as applicable.
00020 //
00021 
00022 
00023 #ifndef _DWFCORE_ZIP_FILE_DESCRIPTOR_H
00024 #define _DWFCORE_ZIP_FILE_DESCRIPTOR_H
00025 
00026 
00031 
00032 #include "dwfcore/String.h"
00033 #include "dwfcore/InputStream.h"
00034 #include "dwfcore/OutputStream.h"
00035 #include "dwfcore/FileDescriptor.h"
00036 #include "dwfcore/zip/zip.h"
00037 #include "dwfcore/zip/unzip.h"
00038 #include "dwfcore/Owner.h"
00039 
00040 
00041 namespace DWFCore
00042 {
00043 
00044 class DWFZipFileDescriptor;
00045 class DWFStreamOutputBufferDescriptor;
00046 
00055 class DWFZipFileIndex : virtual public DWFCoreMemory
00056 {
00057     friend class DWFZipFileDescriptor;
00058 public:
00059     DWFZipFileIndex()
00060         : _oUnzIndex()
00061     {;}
00062 
00063 protected:
00069     unzIndex * index() throw() { return &_oUnzIndex; }
00070 
00071 private:
00076     unzIndex    _oUnzIndex;
00077 
00078 };
00079 
00088 class DWFZipFileDescriptor : virtual public DWFCoreMemory
00089                            , public DWFFileDescriptor
00090                            , public DWFOwnable
00091 {
00092 
00093 public:
00094 
00107     typedef enum teFileMode
00108     {
00112         eUnzip              = -2,
00113 
00118         eZip                = -1,
00119         
00123         eZipNone            = 0,
00124 
00129         eZipFastest         = 1,
00130 
00136         eZipFast            = 3,
00137 
00143         eZipBlendFaster     = 5,
00144 
00150         eZipBlendSmaller    = 7,
00151 
00157         eZipSmaller         = 8,
00158 
00164         eZipSmallest        = 9
00165 
00166     } teFileMode;
00167 
00172     typedef enum
00173     {
00177         eEncrypted,
00178 
00182         eNotEncrypted,
00183 
00188         eEncryptionUnknown
00189     } teEncryption;
00190 
00191 public:
00192 
00204     _DWFCORE_API 
00205     DWFZipFileDescriptor( const DWFFile& rFile,
00206                           teFileMode     eMode )
00207         throw();
00208 
00220     _DWFCORE_API 
00221     DWFZipFileDescriptor( teFileMode eMode )
00222         throw();
00223 
00238     _DWFCORE_API 
00239     DWFZipFileDescriptor( DWFInputStream& rStream )
00240         throw();
00241 
00247     _DWFCORE_API 
00248     virtual ~DWFZipFileDescriptor()
00249         throw();
00250 
00257     _DWFCORE_API 
00258     virtual void open()
00259         throw( DWFException );
00260 
00271     _DWFCORE_API 
00272     virtual void openIndexed(DWFZipFileIndex* pIndex)
00273         throw( DWFException );
00274 
00275 
00281     _DWFCORE_API 
00282     void close()
00283         throw( DWFException );
00284 
00293     _DWFCORE_API 
00294     size_t size()
00295         throw( DWFException );
00296 
00313     _DWFCORE_API 
00314     size_t read( void* pBuffer, size_t nBytesToRead )
00315         throw( DWFException );
00316 
00325     _DWFCORE_API 
00326     off_t seek( int eOrigin, off_t nOffset )
00327         throw( DWFException );
00328 
00339     _DWFCORE_API 
00340     bool locate( const DWFString& rArchivedFile )
00341         throw( DWFException );
00342 
00356     _DWFCORE_API 
00357     DWFInputStream* unzip( const DWFString& zArchivedFile,
00358                            const DWFString& zPassword = /*NOXLATE*/L"" )
00359         throw( DWFException );
00360 
00375     _DWFCORE_API 
00376     DWFOutputStream* zip( const DWFString& zArchiveFile,
00377                           const DWFString& zPassword = /*NOXLATE*/L"",
00378                           bool bPKZIPCompliantPassword = true )
00379         throw( DWFException );
00380 
00396     _DWFCORE_API 
00397     DWFOutputStream* zip( const DWFString& zArchiveFile,
00398                           teFileMode eZipMode,
00399                           const DWFString& zPassword = /*NOXLATE*/L"",
00400                           bool bPKZIPCompliantPassword = true )
00401         throw( DWFException );
00402 
00412     _DWFCORE_API 
00413     teEncryption encryption()
00414         throw( DWFException );
00415 
00424     _DWFCORE_API
00425     const unsigned char* buffer()
00426         throw( DWFException );
00427 
00438     _DWFCORE_API
00439     size_t buffer( unsigned char*& rpBuffer )
00440         throw( DWFException );
00441 
00448     _DWFCORE_API
00449     bool archiveCreatedInMemory()
00450         throw()
00451     {
00452         return _bCreateArchiveInMemory;
00453     }
00454 
00461     _DWFCORE_API
00462     teFileMode mode()
00463         throw()
00464     {
00465         return _eMode;
00466     }
00467 
00468 protected:
00469 
00473     teFileMode                          _eMode;
00474 
00478     teEncryption                        _eEncryption; 
00479 
00483     zipFile                             _pZipStream;
00484 
00488     unzFile                             _pUnzipStream;
00489 
00493     DWFInputStream*                     _pInputStream;
00494 
00498     bool                                _bCreateArchiveInMemory;
00499 
00503     DWFStreamOutputBufferDescriptor*    _pStreamOutputDescriptor;
00504 
00508     DWFZipFileIndex                     _oZipFileIndex;
00509 
00510 private:
00511 
00512 
00513     //
00514     // Not Implemented
00515     //
00516     DWFZipFileDescriptor();
00517     DWFZipFileDescriptor( const DWFZipFileDescriptor& );
00518     DWFZipFileDescriptor& operator=( const DWFZipFileDescriptor& );
00519 
00520 };
00521 
00522 }
00523 
00524 #endif

Generated on Tue Jan 6 22:39:29 2009 for Autodesk DWF Core Library by  doxygen 1.4.5