wpQueryRefreshFlags - Remarks
The refresh flags consist of a DIRTYBIT and a FOUNDBIT that are used to
detect deleted files and new files when refreshing the contents of a folder.
For example, if you develop a subclass of wpFolder which contains objects
that represent entries in a database (where the database may get updated
independently from your objects), you might want to resynchronize your folder
full of objects with the contents of the database. One possible technique
follows:
- Loop through all of the objects in the folder
and turn on the DIRTYBIT and turn off the FOUNDBIT for all of your objects.
- Loop through the database. For every entry in
the database, find the corresponding object.
a.
If the object exists, turn on the FOUNDBIT for
the object.
b.
If the object doesn't exist, create a new
object with the FOUNDBIT turned on and the DIRTYBIT turned off.
3.
Loop through the objects in the folder again.
For any object that has the FOUNDBIT turned off, delete the object (since
there is no longer a corresponding entry in the database). For any object
that has the DIRTYBIT turned on, update the view with the current contents
of the object and turn its DIRTYBIT off.
This kind of technique can be implemented using private flags, or by using
the flags provided by the wpQueryRefreshFlags and wpSetRefreshFlags methods.
[Back: wpQueryRefreshFlags - Parameters]
[Next: wpQueryRefreshFlags - Usage]