Make WvStreams compile with gcc 4.4.
[wvstreams.git] / include / uniwatch.h
blobc29aebc53ab36d8183b3cb4f59d069a639a1887d
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.
11 #ifndef __UNIWATCH_H
12 #define __UNIWATCH_H
14 #include "uniconf.h"
16 class UniWatch
18 UniConf cfg;
19 UniConfCallback cb;
20 bool recurse;
22 public:
23 // standard "add_callback" version
24 UniWatch(const UniConf &_cfg, const UniConfCallback &_cb,
25 bool _recurse = true);
27 // special "add_setbool" version
28 UniWatch(const UniConf &_cfg, bool *b, bool _recurse = true);
30 ~UniWatch();
33 DeclareWvList2(UniWatchListBase, UniWatch);
35 class UniWatchList : public UniWatchListBase
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); }
46 #endif // __UNIWATCH_H