This example shows how you can use the refresh flags to synchronize the contents of a folder with the contents of a data base. somSelf is the pointer to the folder containing the objects corresponding to the items in the database.
MyObject *Object,*NextObject;
/* Mark all existing objects as not found */
Object = (MyObject*)_wpQueryContent(somSelf,NULL,QC_FIRST);
while (Object)
{
_wpSetRefreshFlags(Object,0);
Object = (MyObject*)_wpQueryContent(somSelf,Object,QC_NEXT);
}
/* Loop through the data base. For each item in the data base, find the
* corresponding object and call the wpSetRefreshFlags method for the
* object to set FOUNDBIT on. For any item that does not have a
* corresponding object, create the object and call the wpSetRefreshFlags
* method for the new object to set the FOUNDBIT on. */
/***** The code for the above described loop goes here *****/
/* Remove all objects corresponding to data base entries that have been
* deleted from the data base */
Object = (MyObject*)_wpQueryContent(somSelf,NULL,QC_FIRST);
while (Object)
{
NextObject = (MyObject*)_wpQueryContent(somSelf,Object,QC_NEXT);
ulFlags = _wpQueryRefreshFlags(Object);
if (!(ulFlags & FOUNDBIT))
{
Object->wpDelete(0);
}
Object = NextObject;
}