Using sets with members of the same type

You can construct empty sets and add each member using the Add function, or construct the set using an existing set. You can also assign the contents of one set to another.

This example creates a TPropertyIDSet using file system property identifiers, then retrieves the property values for each member of the set. This code uses an existing file surrogate named aFile.

      TPropertySet                propSet;
      TExtendedProperty<TFileSystemEntityName> nameProp(TFileSystemEntity::kName);
      TExtendedProperty<TTime>   createTimProp(TFileSystemEntity::kCreationTime);
      TExtendedProperty<TTime>   modifyTimeProp(TFileSystemEntity::kModificationTime);
      
      propSet.Add(nameProp);
      propSet.Add(createTimeProp);
      propSet.Add(modifyTimeProp);
      aFile.ReadProperties(propSet);
Sets provide functions that perform other useful actions, such as checking for membership, returning member counts, deleting individual members, and deleting all members. Using TPropertySet, you can also Get the value for an individual member.


[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