Manifest.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, 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/Manifest.h#2 $
00019 //  $DateTime: 2008/06/18 18:08:14 $
00020 //  $Author: gaoje $
00021 //  $Change: 101166 $
00022 //  $Revision: #2 $
00023 //
00024 
00025 
00026 #ifndef _DWFTK_MANIFEST_H
00027 #define _DWFTK_MANIFEST_H
00028 
00029 
00034 
00035 
00036 #include "dwf/Toolkit.h"
00037 #include "dwf/package/Section.h"
00038 #include "dwf/package/GlobalSection.h"
00039 #include "dwf/package/writer/PackageWriter.h"
00040 #include "dwf/package/reader/PackageManifestReader.h"
00041 #include "dwf/package/utility/PropertyContainer.h"
00042 #include "dwf/presentation/PackageContentPresentations.h"
00043 
00044 #include "dwfcore/Owner.h"
00045 #include "dwfcore/Iterator.h"
00046 using namespace DWFCore;
00047 
00048 
00049 namespace DWFToolkit
00050 {
00051 
00052 //
00053 // fwd declarations
00054 //
00055 class DWFContentManager;
00056 
00057 
00065 class DWFManifest : public DWFManifestReader
00066 
00067 #ifndef DWFTK_READ_ONLY
00068                   , public DWFXMLSerializable
00069 #endif
00070                   , public DWFPropertyContainer
00071                   _DWFTK_EXPORT_API_MEMORY_CONTROL_BASE_MEMBER
00072 {
00073 
00074 public:
00075 
00079     typedef DWFWCharKeySkipList<DWFInterface*>::Iterator    tInterfaceIterator;
00080 
00088     class SectionIterator : public DWFIterator<DWFSection*>
00089                             _DWFTK_EXPORT_API_MEMORY_CONTROL_BASE_MEMBER
00090     {
00091 
00092     public:
00093 
00101         SectionIterator( DWFSection::tList::iterator iBegin,
00102                          DWFSection::tList::iterator iEnd )
00103             throw()
00104             : _bList( true )
00105             , _ilBegin( iBegin )
00106             , _ilEnd( iEnd )
00107             , _ilCurrent( iBegin )
00108         {;}
00109 
00117         SectionIterator( DWFSection::tMultiMap::iterator iBegin,
00118                          DWFSection::tMultiMap::iterator iEnd )
00119             throw()
00120             : _bList( false )
00121             , _imBegin( iBegin )
00122             , _imEnd( iEnd )
00123             , _imCurrent( iBegin )
00124         {;}
00125 
00132         SectionIterator( const SectionIterator& i )
00133             throw()
00134             : _bList( i._bList )
00135             , _ilBegin( i._ilBegin )
00136             , _ilEnd( i._ilEnd )
00137             , _ilCurrent( i._ilCurrent )
00138             , _imBegin( i._imBegin )
00139             , _imEnd( i._imEnd )
00140             , _imCurrent( i._imCurrent )
00141         {;}
00142 
00149         SectionIterator& operator=( const SectionIterator& i )
00150             throw()
00151         {
00152             _ilBegin = i._ilBegin;
00153             _ilEnd = i._ilEnd;
00154             _ilCurrent = i._ilCurrent;
00155 
00156             _imBegin = i._imBegin;
00157             _imEnd = i._imEnd;
00158             _imCurrent = i._imCurrent;
00159 
00160             _bList = i._bList;
00161 
00162             return *this;
00163         }
00164 
00170         virtual ~SectionIterator()
00171             throw()
00172         {;}
00173 
00177         void reset()
00178             throw()
00179         {
00180             if (_bList)
00181             {
00182                 _ilCurrent = _ilBegin;
00183             }
00184             else
00185             {
00186                 _imCurrent = _imBegin;
00187             }
00188         }
00189 
00193         bool valid()
00194             throw()
00195         {
00196             return (_bList ? (_ilCurrent != _ilEnd) : (_imCurrent != _imEnd));
00197         }
00198 
00202         bool next()
00203             throw()
00204         {
00205             if (valid())
00206             {
00207                 if (_bList)
00208                 {
00209                     _ilCurrent++;
00210                 }
00211                 else
00212                 {
00213                     _imCurrent++;
00214                 }
00215 
00216                 return valid();
00217             }
00218             else
00219             {
00220                 return false;
00221             }
00222         }
00223 
00227         DWFSection*& get()
00228             throw( DWFException )
00229         {
00230             if (valid())
00231             {
00232                 return (_bList ? *_ilCurrent : _imCurrent->second);
00233             }
00234             else
00235             {
00236                 _DWFCORE_THROW( DWFDoesNotExistException, /*NOXLATE*/L"No more elements" );
00237             }
00238         }
00239 
00240     private:
00241 
00242         bool _bList;
00243 
00244         DWFSection::tList::iterator _ilBegin;
00245         DWFSection::tList::iterator _ilEnd;
00246         DWFSection::tList::iterator _ilCurrent;
00247 
00248         DWFSection::tMultiMap::iterator _imBegin;
00249         DWFSection::tMultiMap::iterator _imEnd;
00250         DWFSection::tMultiMap::iterator _imCurrent;
00251     };
00252 
00253 public:
00254 
00267     _DWFTK_API
00268     DWFManifest( DWFPackageReader* pPackageReader )
00269         throw();
00270 
00280     _DWFTK_API
00281     DWFManifest( const DWFString& zObjectID )
00282         throw();
00283 
00289     _DWFTK_API
00290     virtual ~DWFManifest()
00291         throw();
00292 
00299     _DWFTK_API
00300     double version() const
00301         throw()
00302     {
00303         return _nVersion;
00304     }
00305 
00312     _DWFTK_API
00313     const DWFString& objectID() const
00314         throw()
00315     {
00316         return _zObjectID;
00317     }
00318 
00326     _DWFTK_API
00327     tInterfaceIterator* getInterfaces()
00328         throw();
00329 
00340     _DWFTK_API
00341     DWFSection* findSectionByName( const DWFString& zName )
00342         throw();
00343 
00354     _DWFTK_API
00355     SectionIterator* findSectionsByType( const DWFString& zType )
00356         throw();
00357 
00367     _DWFTK_API
00368     SectionIterator* getSections()
00369         throw();
00370 
00380     _DWFTK_API
00381     SectionIterator* getGlobalSections()
00382         throw();
00383 
00392     _DWFTK_API
00393     DWFContentManager* getContentManager() const
00394         throw()
00395     {
00396         return _pContentManager;
00397     }
00398 
00410     _DWFTK_API
00411     DWFContentPresentation::tList::Iterator* getContentPresentations()
00412         throw()
00413     {
00414         DWFContentPresentation::tList::Iterator* piPresentations = NULL;
00415         if (_pPackageContentPresentations)
00416         {
00417             piPresentations = _pPackageContentPresentations->getPresentations();
00418         }
00419 
00420         return piPresentations;
00421     }
00422 
00434     _DWFTK_API
00435     DWFContentPresentation::tList::ConstIterator* getContentPresentations() const
00436         throw()
00437     {
00438         DWFContentPresentation::tList::ConstIterator* piPresentations = NULL;
00439         if (_pPackageContentPresentations)
00440         {
00441             piPresentations = ((const DWFContentPresentationContainer*)(_pPackageContentPresentations))->getPresentations();
00442         }
00443 
00444         return piPresentations;
00445     }
00446 
00456     _DWFTK_API
00457     void attachContentManager( DWFContentManager* pContentManager, bool bTakeOwnership = true, bool bDeletePrevious = true )
00458         throw( DWFException );
00459 
00463     _DWFTK_API
00464     double provideVersion( double nVersion )
00465         throw();
00466 
00470     _DWFTK_API
00471     const char* provideObjectID( const char* zObjectID )
00472         throw();
00473 
00477     _DWFTK_API
00478     DWFDependency* provideDependency( DWFDependency* pDependency )
00479         throw();
00480 
00484     _DWFTK_API
00485     DWFInterface* provideInterface( DWFInterface* pInterface )
00486         throw();
00487 
00491     _DWFTK_API
00492     DWFProperty* provideProperty( DWFProperty* pProperty )
00493         throw();
00494 
00498     _DWFTK_API
00499     DWFSection* provideSection( DWFSection* pSection )
00500         throw();
00501 
00514     _DWFTK_API
00515     DWFContent* provideContent( DWFContent* pContent )
00516         throw( DWFException );
00517 
00521     _DWFTK_API
00522     DWFPackageContentPresentations* provideContentPresentations( DWFPackageContentPresentations* pPackageContentPresentations )
00523         throw();
00524 
00525 #ifndef DWFTK_READ_ONLY
00526 
00530     _DWFTK_API
00531     void serializeXML( DWFXMLSerializer& rSerializer, unsigned int nFlags )
00532         throw( DWFException );
00533 
00534 #endif
00535 
00536 protected:
00537 
00541     _DWFTK_API
00542     virtual void notifyOwnerChanged( DWFOwnable& rOwnable )
00543         throw( DWFException );
00544 
00548     _DWFTK_API
00549     virtual void notifyOwnableDeletion( DWFOwnable& rOwnable )
00550         throw( DWFException );
00551 
00552 private:
00553 
00554     double                              _nVersion;
00555     DWFString                           _zObjectID;
00556     DWFSection::tList                   _oSectionsInOrder;
00557     DWFSection::tList                   _oGlobalSectionsInOrder;
00558     DWFSection::tMap                    _oSectionsByName;
00559     DWFSection::tMultiMap               _oSectionsByType;
00560     DWFWCharKeySkipList<DWFInterface*>  _oInterfaces;
00561 
00562     DWFContentManager*                  _pContentManager;
00563     DWFPackageContentPresentations*     _pPackageContentPresentations;
00564 };
00565 
00566 }
00567 
00568 #endif

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