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

PropertyContainer.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_PROPERTY_CONTAINER_H
00021 #define _DWFTK_PROPERTY_CONTAINER_H
00022 
00023 
00028 
00029 #include "dwfcore/STL.h"
00030 
00031 #include "dwf/Toolkit.h"
00032 #include "dwf/package/Property.h"
00033 
00034 namespace DWFToolkit
00035 {
00036 
00050 class DWFPropertyContainer : protected DWFOwner
00051 {
00052 
00053 public:
00054 
00058     typedef vector<DWFPropertyContainer*>    tList;
00059 
00060 public:
00061 
00068     _DWFTK_API
00069     DWFPropertyContainer( const DWFString& zID = L"" )
00070         throw();
00071 
00080     _DWFTK_API
00081     virtual ~DWFPropertyContainer()
00082         throw();
00083 
00090     virtual const DWFString& id() const
00091     {
00092         return _zID;
00093     }
00094 
00106     _DWFTK_API
00107     virtual const DWFProperty* const findProperty( const DWFString& zName,
00108                                                    const DWFString& zCategory = L"" )
00109         throw();
00110 
00123     _DWFTK_API
00124     virtual DWFProperty::tMap::Iterator* getProperties( const DWFString& zCategory = L"" )
00125         throw();
00126 
00136     _DWFTK_API
00137     virtual void addProperty( DWFProperty* pProperty,
00138                               bool         bOwnProperty )
00139         throw( DWFException );
00140 
00153     _DWFTK_API
00154     virtual void addPropertyContainer( DWFPropertyContainer* pContainer )
00155         throw( DWFException );
00156 
00167     _DWFTK_API
00168     virtual void referencePropertyContainer( const DWFPropertyContainer& rContainer )
00169         throw( DWFException );
00170 
00182     _DWFTK_API
00183     virtual void getOwnedPropertyContainers( DWFPropertyContainer::tList& rContainerList )
00184         throw( DWFException );
00185 
00196     _DWFTK_API
00197     virtual void getReferencedPropertyContainers( DWFPropertyContainer::tList& rContainerList )
00198         throw( DWFException );
00199 
00209     _DWFTK_API
00210     virtual void getAllPropertyContainers( DWFPropertyContainer::tList& rContainerList )
00211         throw( DWFException );
00212 
00227     _DWFTK_API
00228     virtual void removeOwnedPropertyContainers( DWFPropertyContainer::tList& rContainerList,
00229                                                 bool                         bMakeReferences = false )
00230         throw( DWFException );
00231 
00242     _DWFTK_API
00243     virtual void removeReferencedPropertyContainers( DWFPropertyContainer::tList& rContainerList )
00244         throw( DWFException );
00245 
00254     _DWFTK_API
00255     virtual void removeAllPropertyContainers( DWFPropertyContainer::tList& rContainerList )
00256         throw( DWFException );
00257 
00273     _DWFTK_API
00274     virtual void copyProperties( DWFPropertyContainer& rContainer,
00275                                  bool                  bRemoveOwnership = false,
00276                                  bool                  bMakeReferences = false)
00277         throw( DWFException );
00278 
00279 
00280 #ifndef DWFTK_READ_ONLY
00281 
00289     DWFXMLSerializable& getSerializable() const
00290         throw()
00291     {
00292         return (DWFXMLSerializable&)_oSerializer;
00293     }
00294 #endif
00295 
00296 protected:
00297 
00298 
00302     _DWFTK_API
00303     virtual void notifyOwnerChanged( DWFOwnable& rOwnable )
00304         throw( DWFException );
00305 
00309     _DWFTK_API
00310     virtual void notifyOwnableDeletion( DWFOwnable& rOwnable )
00311         throw( DWFException );
00312 
00313 #ifndef DWFTK_READ_ONLY
00314 
00315 private:
00316 
00317     //
00318     // in order to avoid bizarre diamond patterns and
00319     // excessively overload base implementations,
00320     // all container classes must define and implementation this
00321     // internal [PRIVATE] class utility for serializing themselves into XML.
00322     //
00323     class _Serializer : public DWFXMLSerializable
00324     {
00325 
00326     public:
00327 
00328         _Serializer()
00329             throw()
00330             : DWFXMLSerializable()
00331             , _pContainer( NULL )
00332         {;}
00333 
00334         virtual ~_Serializer()
00335             throw()
00336         {;}
00337 
00338         void is( DWFPropertyContainer* pContainer )
00339         {
00340             _pContainer = pContainer;
00341         }
00342 
00343         //
00344         //
00345         //
00346         virtual void serializeXML( DWFXMLSerializer& rSerializer, unsigned int nFlags )
00347             throw( DWFException );
00348 
00349     private:
00350 
00351         DWFPropertyContainer* _pContainer;
00352     };
00353 
00354 private:
00355 
00356     //
00357     // Assigns a transient ID for this property container
00358     // This method is only intended for internal use within serialize()
00359     //
00360     void identify( const DWFString& zID )
00361         throw()
00362     {
00363         _zID = zID;
00364     }
00365 
00366 #endif
00367 
00368 
00369 protected:
00370 
00374     DWFProperty::tMap           _oProperties;
00378     DWFPropertyContainer::tList _oContainers;
00382     DWFPropertyContainer::tList _oReferences;
00383 
00384 private:
00385 
00386     DWFString                   _zID;
00387 
00388 #ifndef DWFTK_READ_ONLY
00389 
00390     _Serializer                 _oSerializer;
00391 
00392 #endif
00393 
00394 
00395 
00396 private:
00397 
00398     DWFPropertyContainer( const DWFPropertyContainer& );
00399     DWFPropertyContainer& operator=( const DWFPropertyContainer& );
00400 };
00401 
00402 }
00403 
00404 #endif

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