Oops, my fix to subdir.mk didn't work with existing symlinks. Fixed.
[wvapps.git] / wvsync / wvsynclister.h
blob45dc45eb81abdfbaed93fd259efc9375c10ea0ab
1 /*
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
11 * WvSyncFile objects.
15 #ifndef __WVSYNCLISTER_H
16 #define __WVSYNCLISTER_H
18 #include <wvstring.h>
19 #include <wvstringtable.h>
20 #include <wvlog.h>
22 class WvSyncProtocol;
23 class WvSyncObj;
24 class UniConf;
26 class WvSyncLister
28 public:
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().
36 void run();
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
44 * remote side.
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
57 * directory.
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
70 * marked as done.
72 * cleardone() clears the list of objects marked done. Called on a
73 * chdir, for example.
75 void markdone(WvStringParm name);
76 bool isdone(WvStringParm name);
77 void cleardone();
79 protected:
80 void do_chdir(WvStringParm dir);
82 WvSyncProtocol &prot;
84 private:
85 WvLog log, err;
87 WvStringTable donetbl;
89 WvSyncObj *curobj;
92 #endif // __WVSYNCLISTER_H