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

Manifest.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_MANIFEST_H
00021 #define _DWFTK_MANIFEST_H
00022 
00023 
00028 
00029 
00030 #include "dwf/Toolkit.h"
00031 #include "dwf/package/Section.h"
00032 #include "dwf/package/GlobalSection.h"
00033 #include "dwf/package/writer/PackageWriter.h"
00034 #include "dwf/package/reader/PackageManifestReader.h"
00035 #include "dwf/package/utility/PropertyContainer.h"
00036 
00037 #include "dwfcore/Owner.h"
00038 #include "dwfcore/Iterator.h"
00039 using namespace DWFCore;
00040 
00041 
00042 namespace DWFToolkit
00043 {
00044 
00052 class DWFManifest : public DWFManifestReader
00053 
00054 #ifndef DWFTK_READ_ONLY
00055                   , public DWFXMLSerializable
00056 #endif
00057                   , public DWFPropertyContainer
00058 {
00059 
00060 public:
00061 
00065     typedef DWFWCharKeySkipList<DWFInterface*>::Iterator    tInterfaceIterator;
00066 
00074     class SectionIterator : public DWFToolkitMemory
00075                           , public DWFIterator<DWFSection*>
00076     {
00077 
00078     public:
00079 
00087         SectionIterator( DWFSection::tList::iterator iBegin,
00088                          DWFSection::tList::iterator iEnd )
00089             throw()
00090             : _bList( true )
00091             , _ilBegin( iBegin )
00092             , _ilEnd( iEnd )
00093             , _ilCurrent( iBegin )
00094         {;}
00095 
00103         SectionIterator( DWFSection::tMultiMap::iterator iBegin,
00104                          DWFSection::tMultiMap::iterator iEnd )
00105             throw()
00106             : _bList( false )
00107             , _imBegin( iBegin )
00108             , _imEnd( iEnd )
00109             , _imCurrent( iBegin )
00110         {;}
00111 
00118         SectionIterator( const SectionIterator& i )
00119             throw()
00120             : _bList( i._bList )
00121             , _ilBegin( i._ilBegin )
00122             , _ilEnd( i._ilEnd )
00123             , _ilCurrent( i._ilCurrent )
00124             , _imBegin( i._imBegin )
00125             , _imEnd( i._imEnd )
00126             , _imCurrent( i._imCurrent )
00127         {;}
00128 
00135         SectionIterator& operator=( const SectionIterator& i )
00136             throw()
00137         {
00138             _ilBegin = i._ilBegin;
00139             _ilEnd = i._ilEnd;
00140             _ilCurrent = i._ilCurrent;
00141 
00142             _imBegin = i._imBegin;
00143             _imEnd = i._imEnd;
00144             _imCurrent = i._imCurrent;
00145 
00146             _bList = i._bList;
00147 
00148             return *this;
00149         }
00150 
00156         virtual ~SectionIterator()
00157             throw()
00158         {;}
00159 
00163         void reset()
00164             throw()
00165         {
00166             if (_bList)
00167             {
00168                 _ilCurrent = _ilBegin;
00169             }
00170             else
00171             {
00172                 _imCurrent = _imBegin;
00173             }
00174         }
00175 
00179         bool valid()
00180             throw()
00181         {
00182             return (_bList ? (_ilCurrent != _ilEnd) : (_imCurrent != _imEnd));
00183         }
00184 
00188         bool next()
00189             throw()
00190         {
00191             if (valid())
00192             {
00193                 if (_bList)
00194                 {
00195                     _ilCurrent++;
00196                 }
00197                 else
00198                 {
00199                     _imCurrent++;
00200                 }
00201 
00202                 return valid();
00203             }
00204             else
00205             {
00206                 return false;
00207             }
00208         }
00209 
00213         DWFSection*& get()
00214             throw( DWFException )
00215         {
00216             if (valid())
00217             {
00218                 return (_bList ? *_ilCurrent : _imCurrent->second);
00219             }
00220             else
00221             {
00222                 _DWFCORE_THROW( DWFDoesNotExistException, L"No more elements" );
00223             }
00224         }
00225 
00226     private:
00227 
00228         bool _bList;
00229 
00230         DWFSection::tList::iterator _ilBegin;
00231         DWFSection::tList::iterator _ilEnd;
00232         DWFSection::tList::iterator _ilCurrent;
00233 
00234         DWFSection::tMultiMap::iterator _imBegin;
00235         DWFSection::tMultiMap::iterator _imEnd;
00236         DWFSection::tMultiMap::iterator _imCurrent;
00237     };
00238 
00239 public:
00240 
00253     _DWFTK_API
00254     DWFManifest( DWFPackageReader* pPackageReader )
00255         throw();
00256 
00266     _DWFTK_API
00267     DWFManifest( const DWFString& zObjectID )
00268         throw();
00269 
00275     _DWFTK_API
00276     virtual ~DWFManifest()
00277         throw();
00278 
00285     _DWFTK_API
00286     double version() const
00287         throw()
00288     {
00289         return _nVersion;
00290     }
00291 
00298     _DWFTK_API
00299     const DWFString& objectID() const
00300         throw()
00301     {
00302         return _zObjectID;
00303     }
00304 
00312     _DWFTK_API
00313     tInterfaceIterator* getInterfaces()
00314         throw();
00315 
00326     _DWFTK_API
00327     DWFSection* findSectionByName( const DWFString& zName )
00328         throw();
00329 
00340     _DWFTK_API
00341     SectionIterator* findSectionsByType( const DWFString& zType )
00342         throw();
00343 
00353     _DWFTK_API
00354     SectionIterator* getSections()
00355         throw();
00356 
00366     _DWFTK_API
00367     SectionIterator* getGlobalSections()
00368         throw();
00369 
00373     _DWFTK_API
00374     double provideVersion( double nVersion )
00375         throw();
00376 
00380     _DWFTK_API
00381     const char* provideObjectID( const char* zObjectID )
00382         throw();
00383 
00387     _DWFTK_API
00388     DWFDependency* provideDependency( DWFDependency* pDependency )
00389         throw();
00390 
00394     _DWFTK_API
00395     DWFInterface* provideInterface( DWFInterface* pInterface )
00396         throw();
00397 
00401     _DWFTK_API
00402     DWFProperty* provideProperty( DWFProperty* pProperty )
00403         throw();
00404 
00408     _DWFTK_API
00409     DWFSection* provideSection( DWFSection* pSection )
00410         throw();
00411 
00412 #ifndef DWFTK_READ_ONLY
00413 
00417     _DWFTK_API
00418     void serializeXML( DWFXMLSerializer& rSerializer, unsigned int nFlags )
00419         throw( DWFException );
00420 
00421 #endif
00422 
00423 protected:
00424 
00428     _DWFTK_API
00429     virtual void notifyOwnerChanged( DWFOwnable& rOwnable )
00430         throw( DWFException );
00431 
00435     _DWFTK_API
00436     virtual void notifyOwnableDeletion( DWFOwnable& rOwnable )
00437         throw( DWFException );
00438 
00439 private:
00440 
00441     double                              _nVersion;
00442     DWFString                           _zObjectID;
00443     DWFSection::tList                   _oSectionsInOrder;
00444     DWFSection::tList                   _oGlobalSectionsInOrder;
00445     DWFSection::tMap                    _oSectionsByName;
00446     DWFSection::tMultiMap               _oSectionsByType;
00447     DWFWCharKeySkipList<DWFInterface*>  _oInterfaces;
00448 };
00449 
00450 }
00451 
00452 #endif

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