WvStreams
uniwatch.h
1 /* -*- Mode: C++ -*-
2  * Worldvisions Weaver Software:
3  * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4  *
5  * A class that does add_callback when created and del_callback when
6  * destroyed, thus making it harder to do one or the other incorrectly.
7  *
8  * Because it's an object itself, it uses its own 'this' pointer as the
9  * 'cookie', so you don't have to come up with one.
10  */
11 #ifndef __UNIWATCH_H
12 #define __UNIWATCH_H
13 
14 #include "uniconf.h"
15 
16 class UniWatch
17 {
18  UniConf cfg;
19  UniConfCallback cb;
20  bool recurse;
21 
22 public:
23  // standard "add_callback" version
24  UniWatch(const UniConf &_cfg, const UniConfCallback &_cb,
25  bool _recurse = true);
26 
27  // special "add_setbool" version
28  UniWatch(const UniConf &_cfg, bool *b, bool _recurse = true);
29 
30  ~UniWatch();
31 };
32 
33 DeclareWvList2(UniWatchListBase, UniWatch);
34 
35 class UniWatchList : public UniWatchListBase
36 {
37 public:
38  void add(const UniConf &_cfg, const UniConfCallback &_cb,
39  bool _recurse = true)
40  { append(new UniWatch(_cfg, _cb, _recurse), true); }
41  void add(const UniConf &_cfg, bool *b, bool _recurse = true)
42  { append(new UniWatch(_cfg, b, _recurse), true); }
43 };
44 
45 
46 #endif // __UNIWATCH_H
UniConf
UniConf instances function as handles to subtrees of a UniConf tree and expose a high-level interface...
Definition: uniconf.h:50
UniWatch
Definition: uniwatch.h:16
UniWatchList
Definition: uniwatch.h:35