Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages | Examples

PackageReader.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 1996-2005 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, AS TO THE CORRECTNESS
00008 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00009 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00010 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00011 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00012 //
00013 //  Use, duplication, or disclosure by the U.S. Government is subject to
00014 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00015 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00016 //  Data and Computer Software), as applicable.
00017 //
00018 
00019 
00020 #ifndef _DWFTK_PACKAGE_READER_H
00021 #define _DWFTK_PACKAGE_READER_H
00022 
00023 
00028 
00029 #include "dwfcore/SkipList.h"
00030 #include "dwfcore/TempFile.h"
00031 #include "dwfcore/InputStream.h"
00032 #include "dwfcore/ZipFileDescriptor.h"
00033 using namespace DWFCore;
00034 
00035 #include "dwf/Toolkit.h"
00036 
00037 
00038 #ifdef HAVE_CONFIG_H
00039 #include "dwf/config.h"
00040 #endif
00041 
00042 #ifdef  DWFTK_BUILD_EXPAT
00043 #include "dwf/expat/expat.h"
00044 #else
00045 #include <expat.h>
00046 #endif
00047 
00048 
00049 namespace DWFToolkit
00050 {
00051 
00052 //
00053 // fwd decl
00054 //
00055 class DWFManifest;
00056 class DWFManifestReader;
00057 class DWFSectionBuilder;
00058 
00059 
00060 
00061     //
00062     // dictates the size of the heap buffer
00063     // used to cache input stream data for the parser
00064     //
00065 #ifndef DWFTK_XML_PARSER_BUFFER_BYTES
00066 #define DWFTK_XML_PARSER_BUFFER_BYTES   16384
00067 #endif
00068 
00086 class DWFPackageReader : public DWFToolkitMemory
00087 {
00088 
00089 public:
00090 
00094     typedef enum
00095     {
00099         eDWFPackage,
00103         eDWFPackageEncrypted,
00107         eW2DStream,
00111         eDWFStream,
00115         eZIPFile,
00119         eUnknown
00120 
00121     } tePackageType;
00122 
00123     typedef struct
00124     {
00131         unsigned long   nVersion;
00135         tePackageType   eType;
00141         DWFString       zTypeGUID;
00142 
00143     } tPackageInfo;
00144 
00145 public:
00146 
00159     static void XMLCALL StartElementHandler( void*             pCallback,
00160                                              const char*       zName,
00161                                              const char**      ppAttributeList )
00162         throw();
00163 
00174     static void XMLCALL EndElementHandler( void*               pCallback,
00175                                            const char*         zName )
00176         throw();
00177 
00189     static void XMLCALL StartNamespaceDeclHandler( void*       pCallback,
00190                                                    const char* zPrefix,
00191                                                    const char* zURI )
00192         throw();
00193 
00204     static void XMLCALL EndNamespaceDeclHandler( void*         pCallback,
00205                                                  const char*   zPrefix )
00206         throw();
00207 
00219     static void XMLCALL CharacterDataHandler( void*        pCallback,
00220                                               const char*  zCData,
00221                                               int          nLength ) 
00222         throw();
00223 
00224 public:
00225 
00235     _DWFTK_API
00236     DWFPackageReader( const DWFFile&   zDWFPackageFile,
00237                       const DWFString& zDWFPackagePassword = L"" )
00238         throw();
00239 
00249     _DWFTK_API
00250     DWFPackageReader( DWFInputStream&   rDWFPackageStream,
00251                       const DWFString&  zDWFPackagePassword = L"" )
00252         throw();
00253 
00259     _DWFTK_API
00260     virtual ~DWFPackageReader()
00261         throw();
00262 
00269     _DWFTK_API
00270     void setPackagePassword( const DWFString& zDWFPackagePassword )
00271         throw();
00272 
00279     _DWFTK_API
00280     void getPackageInfo( tPackageInfo& rInfo )
00281         throw( DWFException );
00282 
00292     _DWFTK_API
00293     static void GetPackageInfo( const unsigned char* pBuffer,
00294                                 tPackageInfo&        rInfo )
00295         throw( DWFException );
00296 
00306     _DWFTK_API
00307     DWFManifest& getManifest( DWFManifestReader* pFilter = NULL )
00308         throw( DWFException );
00309 
00321     _DWFTK_API
00322     void getManifest( DWFManifestReader& rManifestReader )
00323         throw( DWFException );
00324 
00337     _DWFTK_API
00338     virtual DWFInputStream* extract( const DWFString& zFilename,
00339                                      bool             bCache = false )
00340         throw( DWFException );
00341 
00353     DWFSectionBuilder& getSectionBuilder()
00354         throw( DWFException );
00355 
00356 protected:
00357 
00363     _DWFTK_API
00364     DWFPackageReader()
00365         throw();
00366 
00373     virtual void _open()
00374         throw( DWFException );
00375 
00376 private:
00377 
00378     //
00379     //
00380     //
00381     void _makeSectionBuilder()
00382         throw( DWFException );
00383 
00384 protected:
00385 
00391     DWFStringKeySkipList<DWFTempFile*> _oLocalFileCache;
00392 
00393 private:
00394 
00395     DWFFile                 _zDWFPackage;
00396     DWFString               _zDWFPassword;
00397     DWFInputStream*         _pDWFStream;
00398 
00399     DWFZipFileDescriptor*   _pPackageDescriptor;
00400     tPackageInfo            _tPackageInfo;
00401 
00402     DWFManifest*            _pPackageManifest;
00403     DWFSectionBuilder*      _pSectionBuilder;
00404 
00405 private:
00406 
00407     DWFPackageReader( const DWFPackageReader& );
00408     DWFPackageReader& operator=( const DWFPackageReader& );
00409 };
00410 
00411 }
00412 
00413 #endif

Generated on Tue May 17 12:38:51 2005 for Autodesk DWF Toolkit by  doxygen 1.4.1