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

XML.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_XML_H
00021 #define _DWFTK_XML_H
00022 
00023 
00028 
00029 
00030 #include "dwfcore/Core.h"
00031 #include "dwfcore/String.h"
00032 #include "dwfcore/OutputStream.h"
00033 #include "dwfcore/BufferInputStream.h"
00034 using namespace DWFCore;
00035 
00036 
00037 #include "dwf/Version.h"
00038 #include "dwf/Toolkit.h"
00039 
00040 
00041 namespace DWFToolkit
00042 {
00043 
00044 //
00045 // fwd decl
00046 //
00047 class DWFBookmark;
00048 class DWFDefinedObject;
00049 class DWFDefinedObjectInstance;
00050 class DWFDependency;
00051 class DWFResource;
00052 class DWFFontResource;
00053 class DWFGraphicResource;
00054 class DWFImageResource;
00055 class DWFInterface;
00056 class DWFPaper;
00057 class DWFProperty;
00058 class DWFSource;
00059 class DWFUnits;
00060 class DWFPackageReader;
00061 class DWFXMLSerializer;
00062 
00063 
00077 class DWFXMLCallback
00078 {
00079 
00080 public:
00081 
00087     _DWFTK_API
00088     virtual ~DWFXMLCallback()
00089         throw()
00090     {
00091         if (_pFilter && _bOwnFilter)
00092         {
00093             DWFCORE_FREE_OBJECT( _pFilter );
00094         }
00095     }
00096 
00120     _DWFTK_API
00121     virtual void notifyStartElement( const char*    zName,
00122                                      const char**   ppAttributeList )
00123         throw() = 0;
00124 
00132     _DWFTK_API
00133     virtual void notifyEndElement( const char*      zName )
00134         throw() = 0;
00135 
00146     _DWFTK_API
00147     virtual void notifyStartNamespace( const char*  zPrefix,
00148                                        const char*  zURI )
00149         throw() = 0;
00150 
00160     _DWFTK_API
00161     virtual void notifyEndNamespace( const char*    zPrefix )
00162         throw() = 0;
00163 
00179     _DWFTK_API
00180     virtual void notifyCharacterData( const char*   zCData, 
00181                                       int           nLength ) 
00182         throw() = 0;
00183 
00201         _DWFTK_API
00202         void setStreamFilter( DWFBufferInputStream*     pFilter,
00203                           bool                      bOwnFilter )
00204                 throw()
00205     {
00206         if (_pFilter && _bOwnFilter)
00207         {
00208             DWFCORE_FREE_OBJECT( _pFilter );
00209         }
00210 
00211         _pFilter = pFilter;
00212         _bOwnFilter = bOwnFilter;
00213     }
00214 
00221     _DWFTK_API
00222     DWFBufferInputStream* getStreamFilter() const
00223         throw()
00224     {
00225         return _pFilter;
00226     }
00227 
00228 protected:
00229 
00235     _DWFTK_API
00236     DWFXMLCallback()
00237         throw()
00238         : _nElementDepth( 0 )
00239         , _nNamespaceDepth( 0 )
00240         , _pFilter( NULL )
00241         , _bOwnFilter( false )
00242     {;}
00243 
00244 protected:
00245 
00246     unsigned int            _nElementDepth;
00247     unsigned int            _nNamespaceDepth;
00248 
00249 private:
00250 
00251     DWFBufferInputStream*   _pFilter;
00252     bool                    _bOwnFilter;
00253 };
00254 
00263 class DWFXMLBuildable
00264 {
00265 
00266 public:
00267 
00273     _DWFTK_API
00274     virtual ~DWFXMLBuildable()
00275         throw()
00276     {;}
00277 
00300     _DWFTK_API
00301     virtual void parseAttributeList( const char** ppAttributeList )
00302         throw( DWFException ) = 0;
00303          
00304 protected:
00305 
00311     _DWFTK_API
00312     DWFXMLBuildable()
00313         throw()
00314     {;}
00315 };
00316 
00317 
00325 class DWFXMLElementBuilder : public DWFToolkitMemory
00326 {
00327 
00328 public:
00329 
00335     DWFXMLElementBuilder()
00336         throw();
00337 
00343     virtual ~DWFXMLElementBuilder()
00344         throw();
00345 
00353     virtual DWFResource* buildResource( const char**      ppAttributeList,
00354                                         DWFPackageReader* pPackageReader )
00355         throw( DWFException );
00356 
00364     virtual DWFFontResource* buildFontResource( const char**      ppAttributeList,
00365                                                 DWFPackageReader* pPackageReader )
00366         throw( DWFException );
00367 
00375     virtual DWFImageResource* buildImageResource( const char**      ppAttributeList,
00376                                                   DWFPackageReader* pPackageReader )
00377         throw( DWFException );
00378 
00386     virtual DWFGraphicResource* buildGraphicResource( const char**      ppAttributeList,
00387                                                       DWFPackageReader* pPackageReader )
00388         throw( DWFException );
00389 
00396     virtual DWFBookmark* buildBookmark( const char** ppAttributeList )
00397         throw( DWFException );
00398 
00405     virtual DWFDefinedObject* buildDefinedObject( const char** ppAttributeList )
00406         throw( DWFException );
00407 
00415     virtual DWFDefinedObjectInstance* buildDefinedObjectInstance( const char**  ppAttributeList,
00416                                                                   unsigned long nSequence )
00417         throw( DWFException );
00418 
00425     virtual DWFDependency* buildDependency( const char** ppAttributeList )
00426         throw( DWFException );
00427 
00434     virtual DWFInterface* buildInterface( const char** ppAttributeList )
00435         throw( DWFException );
00436 
00443     virtual DWFPaper* buildPaper( const char** ppAttributeList )
00444         throw( DWFException );
00445 
00452     virtual DWFProperty* buildProperty( const char** ppAttributeList )
00453         throw( DWFException );
00454 
00461     virtual DWFSource* buildSource( const char** ppAttributeList )
00462         throw( DWFException );
00463 
00470     virtual DWFUnits* buildUnits( const char** ppAttributeList )
00471         throw( DWFException );
00472 };
00473 
00474 
00475 #ifndef DWFTK_READ_ONLY
00476 
00477 
00486 class DWFXMLSerializable
00487 {
00488 
00489 public:
00490 
00496     _DWFTK_API
00497     virtual ~DWFXMLSerializable()
00498         throw();
00499 
00507     _DWFTK_API
00508     virtual void serializeXML( DWFXMLSerializer& rSerializer, unsigned int nFlags )
00509         throw( DWFException ) = 0;
00510 
00518     virtual DWFString namespaceXML( unsigned int nFlags ) const
00519         throw();
00520 
00529     _DWFTK_API
00530     virtual void setDefaultNamespace( const DWFString& zDefaultNamespace )
00531         throw( DWFException );
00532 
00533 protected:
00534 
00543     _DWFTK_API
00544     DWFXMLSerializable( const DWFString& zDefaultNamespace = L"" )
00545         throw();
00546 
00547 protected:
00548 
00549     DWFString _zDefaultNamespace;
00550 };
00551 
00552 
00553 #endif
00554 
00555 
00556 }
00557 
00558 
00559 #endif
00560 
00561 

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