2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2004 Net Integration Technologies, Inc.
5 * WvSyncLister is the base-class interface for iterating through a set of
6 * named objects and feeding them to the WvSyncProtocol. You will want to
7 * derive from this for each type of object you synchronize, as I'm sure
8 * you will iterate through them differently.
10 * For example, WvSyncFileLister traverses a filesystem and synchronizes
15 #ifndef __WVSYNCLISTER_H
16 #define __WVSYNCLISTER_H
19 #include <wvstringtable.h>
29 WvSyncLister(WvSyncProtocol
&_prot
);
30 virtual ~WvSyncLister() {}
32 /** run() makes everything happen. It iterates through the collection
33 * of named objects, and tells the protocol to synchronize each one by
34 * calling prot.do_ihave().
38 /** next() is called from run(), and returns the next WvSyncObj to be
39 * processed. It is next()'s job to call prot.do_chdir() and
40 * prot.do_yourturn() if and when necessary.
42 * makeobj() gives you a WvSyncObj with the given name. Used by the
43 * WvSyncProtocol when receiving information about an object from the
46 * You need to override both of these to return the correct kind of
47 * object. For example, WvSyncFileLister::next() and makeobj() should
48 * give you a WvSyncFile *.
51 virtual WvSyncObj
*next() = 0;
52 virtual WvSyncObj
*makeobj(WvStringParm name
) = 0;
54 /** newcwd() is called by the WvSyncProtocol when it receives a CHDIR
55 * command from the remote side. It is our job to set up the
56 * whatever needs setting up (control files, uniconf trees) in this
59 * Returns true on success.
61 * Must override this, since I don't know how your storage space is
62 * laid out. See WvSyncFileLister::newcwd() for an example.
64 virtual bool newcwd(WvStringParm dir
) = 0;
66 /** markdone() marks the object with the given name as done, so we
67 * don't need to sync it again.
69 * isdone() returns true if the object with the given name has been
72 * cleardone() clears the list of objects marked done. Called on a
75 void markdone(WvStringParm name
);
76 bool isdone(WvStringParm name
);
80 void do_chdir(WvStringParm dir
);
87 WvStringTable donetbl
;
92 #endif // __WVSYNCLISTER_H