ContentReader.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 2005-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, 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 //  $Header: //DWF/Development/Components/Internal/DWF Toolkit/v7.6/develop/global/src/dwf/package/reader/ContentReader.h#2 $
00019 //  $DateTime: 2008/06/18 18:08:14 $
00020 //  $Author: gaoje $
00021 //  $Change: 101166 $
00022 //  $Revision: #2 $
00023 //
00024 
00025 #ifndef _DWFTK_CONTENT_READER_H
00026 #define _DWFTK_CONTENT_READER_H
00027 
00032 
00033 #include <stack>
00034 #include "dwfcore/STL.h"
00035 #include "dwfcore/XML.h"
00036 using namespace DWFCore;
00037 
00038 #include "dwf/Toolkit.h"
00039 #include "dwf/package/XML.h"
00040 #include "dwf/package/utility/PropertyContainer.h"
00041 namespace DWFToolkit
00042 {
00043 
00056 class DWFContentReader : public DWFCore::DWFXMLCallback
00057                          _DWFTK_EXPORT_API_MEMORY_CONTROL_BASE_MEMBER
00058 {
00059 
00060 public:
00061 
00068     typedef enum teProviderType
00069     {
00073         eProvideNone                =   0x000,
00074 
00078         eProvideClasses             =   0x001,
00082         eProvideFeatures            =   0x002,
00086         eProvideEntities            =   0x004,
00090         eProvideObjects             =   0x008,
00094         eProvideGroups              =   0x010,
00098         eProvideSharedProperties    =   0x020,
00099 
00103         eProvideVersion             =   0x100,
00104 
00108         eProvideElements            =   0x0FF,
00112         eProvideAttributes          =   0xF00,
00113 
00117         eProvideAll                 =   0xFFF
00118 
00119     } teProviderType;
00120 
00124     typedef DWFXMLBuildable::tUnresolvedList            tUnresolvedList;
00125 
00126 public:
00127 
00134     _DWFTK_API
00135     DWFContentReader( unsigned int nProviderFlags = eProvideAll )
00136         throw();
00137 
00143     _DWFTK_API
00144     virtual ~DWFContentReader()
00145         throw();
00146 
00155     _DWFTK_API
00156     DWFContentReader* filter() const
00157         throw()
00158     {
00159         return _pFilter;
00160     }
00161 
00167     _DWFTK_API
00168     void setFilter( DWFContentReader* pFilter )
00169         throw()
00170     {
00171         _pFilter = pFilter;
00172     }
00173 
00180     _DWFTK_API
00181     unsigned int providerFlags() const
00182     {
00183         return _nProviderFlags;
00184     }
00185 
00193     _DWFTK_API
00194     void setProviderFlags( unsigned int nProviderFlags )
00195     {
00196         _nProviderFlags = nProviderFlags;
00197     }
00198 
00200 
00204     _DWFTK_API
00205     void notifyStartElement( const char*   zName,
00206                              const char**  ppAttributeList )
00207         throw();
00208 
00212     _DWFTK_API
00213     void notifyEndElement( const char*     zName )
00214         throw();
00215 
00219     _DWFTK_API
00220     void notifyStartNamespace( const char* /*zPrefix*/,
00221                                const char* /*zURI*/ )
00222         throw()
00223     {;}
00224 
00228     _DWFTK_API
00229     void notifyEndNamespace( const char*   /*zPrefix*/ )
00230         throw()
00231     {;}
00232 
00236     _DWFTK_API
00237     void notifyCharacterData( const char* /*zCData*/,
00238                               int         /*nLength*/ )
00239         throw()
00240     {;}
00241 
00249     _DWFTK_API
00250     virtual const char* provideVersion( const char* zVersion )
00251         throw( DWFException );
00252 
00262     _DWFTK_API
00263     virtual DWFClass* provideClass( DWFClass* pClass,
00264                                     const tUnresolvedList& rUnresolved )
00265         throw( DWFException );
00266 
00276     _DWFTK_API
00277     virtual DWFFeature* provideFeature( DWFFeature* pFeature,
00278                                         const tUnresolvedList& rUnresolved )
00279         throw( DWFException );
00280 
00290     _DWFTK_API
00291     virtual DWFEntity* provideEntity( DWFEntity* pEntity,
00292                                       const tUnresolvedList& rUnresolved )
00293         throw( DWFException );
00294 
00304     _DWFTK_API
00305     virtual DWFObject* provideObject( DWFObject* pObject,
00306                                       const tUnresolvedList& rUnresolved )
00307         throw( DWFException );
00308 
00318     _DWFTK_API
00319     virtual DWFGroup* provideGroup( DWFGroup* pGroup,
00320                                     const tUnresolvedList& rUnresolved )
00321         throw( DWFException );
00322 
00332     _DWFTK_API
00333     virtual DWFPropertySet* provideSharedProperty( DWFPropertySet* pPropertySet,
00334                                                    const tUnresolvedList& rUnresolved )
00335         throw( DWFException );
00336 
00347     _DWFTK_API
00348     virtual DWFObject* provideChildObject( DWFObject* pObject,
00349                                            DWFObject* pParent,
00350                                            const tUnresolvedList& rUnresolved )
00351        throw( DWFException );
00352 
00363     _DWFTK_API
00364     virtual DWFPropertySet* providePropertySet( DWFPropertySet* pPropertySet,
00365                                                 DWFPropertyContainer* pContainer,
00366                                                 const tUnresolvedList& rUnresolved )
00367         throw( DWFException );
00368 
00376     _DWFTK_API
00377     virtual void resolveClasses()
00378         throw()
00379     {;}
00380 
00388     _DWFTK_API
00389     virtual void resolveFeatures()
00390         throw()
00391     {;}
00392 
00400     _DWFTK_API
00401     virtual void resolveEntities()
00402         throw()
00403     {;}
00404 
00412     _DWFTK_API
00413     virtual void resolveObjects()
00414         throw()
00415     {;}
00416 
00424     _DWFTK_API
00425     virtual void resolveGroups()
00426         throw()
00427     {;}
00428 
00436     _DWFTK_API
00437     virtual void resolvePropertySets()
00438         throw()
00439     {;}
00440 
00441 private:
00442 
00443     _DWFTK_API
00444     void _provideClass()
00445         throw( DWFException );
00446 
00447     _DWFTK_API
00448     void _provideFeature()
00449         throw( DWFException );
00450 
00451     _DWFTK_API
00452     void _provideEntity()
00453         throw( DWFException );
00454 
00455     _DWFTK_API
00456     void _provideObject()
00457         throw( DWFException );
00458 
00459     _DWFTK_API
00460     void _provideGroup()
00461         throw( DWFException );
00462 
00463     _DWFTK_API
00464     void _provideSharedProperty()
00465         throw( DWFException );
00466 
00467     _DWFTK_API
00468     void _provideChildObject()
00469         throw( DWFException );
00470 
00471     _DWFTK_API
00472     void _providePropertySet()
00473         throw( DWFException );
00474 
00475     _DWFTK_API
00476     void _provideVersion( const char* zVersion )
00477         throw( DWFException );
00478 
00479 protected:
00480 
00485     DWFXMLElementBuilder        _oDefaultElementBuilder;
00486 
00492     DWFXMLElementBuilder*       _pElementBuilder;
00493 
00494 
00495 private:
00496 
00497     typedef std::stack< DWFString >                         _tStringStack;
00498     typedef std::stack< DWFPropertyContainer* >             _tPropertyContainerStack;
00499 
00500     typedef std::stack< tUnresolvedList, _DWFTK_STD_VECTOR(tUnresolvedList) >
00501                                                             _tUnresolvedListStack;
00502 
00503 private:
00504 
00505     unsigned int                _nCurrentCollectionProvider;
00506     unsigned int                _nProviderFlags;
00507 
00508     DWFXMLBuildable*            _pCurrentElement;
00509     DWFContentReader*           _pFilter;
00510 
00511     //
00512     //  As we go deeper into the nested object XML elements, information to complete
00513     //  the objects are stored on the stacks, and used during the element close. The
00514     //  object itself is stored on the PropertyContainerStack.
00515     //
00516     //
00517     //  Property Sets can also be arbitrarily nested. The properties and the nested
00518     //  property sets can live inside top level property sets or as a part of 
00519     //  content elements, namely Classes, Features, Entities, Objects  and Groups.
00520     //
00521     //  Content Element Property Structure:
00522     //  <Object id="xyz1" label="abc1">
00523     //      <Property .../>
00524     //      <Property .../>
00525     //      ...
00526     //      <Properties id="xyz21" label="abc21"/>
00527     //          ...
00528     //      </Properties>
00529     //      <Properties id="xyz22" label="abc22"/>
00530     //          ...
00531     //      </Properties>
00532     //      ...
00533     //  </Object>
00534     //
00535     //  Property Set Structure:
00536     //  <Properties id="zyx1" label="cab1"> // This is a property set
00537     //      <Property .../>
00538     //      <Property .../>
00539     //      ...
00540     //      <Properties id="zyx21" label="cab21"/>
00541     //          ...
00542     //      </Properties>
00543     //      <Properties id="zyx22" label="cab22"/>
00544     //          ...
00545     //      </Properties>
00546     //      ...
00547     //  </Properties>
00548     //
00549 
00550     _tPropertyContainerStack            _oPropertyContainer;
00551     _tUnresolvedListStack               _oUnresolved;
00552 
00553 private:
00554 
00555     //
00556     // Not implemented
00557     //
00558     DWFContentReader( const DWFContentReader& );
00559     DWFContentReader& operator=( const DWFContentReader& );
00560 
00561 };
00562 
00563 }
00564 
00565 #endif

Generated on Tue Jan 6 22:40:02 2009 for Autodesk DWF Toolkit by  doxygen 1.4.5