monotone

monotone Mtn Source Tree

Root/src/outdated_indicator.hh

1// Copyright (C) 2007 Timothy Brownawell <tbrownaw@gmail.com>
2//
3// This program is made available under the GNU GPL version 2.0 or
4// greater. See the accompanying file COPYING for details.
5//
6// This program is distributed WITHOUT ANY WARRANTY; without even the
7// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8// PURPOSE.
9
10#ifndef __OUTDATED_NOTIFIER_HH__
11#define __OUTDATED_NOTIFIER_HH__
12
13// Allow clients to find out when something changes.
14// The 'something' has an outdated_indicator_factory,
15// and calls note_change() when changes are made.
16// The client is provided with an outdated_indicator made
17// from that factory, which will become outdated after
18// further changes are made to the something.
19
20// The default indicator is always outdated.
21
22// When a factory is destroyed, all indicators made from
23// that factory become outdated.
24
25#include <boost/shared_ptr.hpp>
26
27class outdated_indicator_factory_impl;
28
29class outdated_indicator
30{
31 boost::shared_ptr<outdated_indicator_factory_impl> parent;
32 unsigned int when;
33public:
34 outdated_indicator();
35 explicit outdated_indicator(boost::shared_ptr<outdated_indicator_factory_impl> p);
36 bool outdated() const;
37};
38
39
40class outdated_indicator_factory
41{
42 boost::shared_ptr<outdated_indicator_factory_impl> impl;
43public:
44 outdated_indicator_factory();
45 ~outdated_indicator_factory();
46 outdated_indicator get_indicator();
47 void note_change();
48};
49
50#endif
51
52// Local Variables:
53// mode: C++
54// fill-column: 76
55// c-file-style: "gnu"
56// indent-tabs-mode: nil
57// End:
58// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status