Extended attributes

An extended attribute is any attribute added to the attribute bundle through the TGrafBundle::AdoptGrafAttribute function. Any attribute you define yourself as long as it descends from TGrafAttribute can be adopted with this function.

TGrafBundle has a CreateBundleIterator function that returns a TGrafBundleIterator instance that you can use to iterate through the extended attributes whenever you need to perform an operation on the extended attributes as a group.

    virtual TGrafBundleIterator* CreateGrafBundleIterator();
The following code fragment shows how you might iterate through a bundle and delete the extended attributes. An attribute retrieved through the iteration operation is stored as a TGrafAttribute instance so that you can delete the attribute by calling the TGrafBundle::OrphanGrafAttribute function.

      TGrafBundle* bundle;
      TGrafBundleIterator* iterator = bundle>CreateGrafBundleIterator();
      
      for( const TGrafAttribute* attrib = iterator>First(); attrib != NIL; 
                      attrib = ( TGrafAttribute* )iterator>Next() )
          delete bundle>OrphanGrafAttribute( attrib>GetName() );
      
      delete iterator;

[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker