]> git.lyx.org Git - lyx.git/blob - src/counters.h
update libtool
[lyx.git] / src / counters.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ====================================================== 
4  * 
5  *           LyX, The Document Processor
6  *
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2001 The LyX Team.
9  *
10  *
11  * ====================================================== */
12
13
14 #ifndef COUNTERS_H
15 #define COUNTERS_H
16
17 #ifdef __GNUG__
18 #pragma interface
19 #endif
20
21 #include <map>
22 #include <sigc++/signal_system.h>
23 #include "LString.h"
24
25 ///
26 class Counter : public SigC::Object {
27 public:
28         ///
29         Counter();
30         ///
31         void set(int v);
32         ///
33         void addto(int v);
34         ///
35         int value() const;
36         ///
37         void step();
38         ///
39         void reset();
40         ///
41         SigC::Signal0<void> onstep;
42 private:
43         ///
44         int value_;
45 };
46
47
48 /** This is a class of (La)TeX type counters. The counters is in a text
49     Style and can be reset by signals emitted from a single counter.
50 */
51 class Counters {
52 public:
53         ///
54         ~Counters();
55         ///
56         void newCounter(string const & newc);
57         ///
58         void newCounter(string const & newc, string const & oldc);
59         ///
60         void set(string const & ctr, int val);
61         ///
62         void addto(string const & ctr, int val);
63         ///
64         int value(string const & ctr) const;
65         ///
66         void step(string const & ctr);
67         // string refstep(string const & cou);
68 private:
69         ///
70         typedef std::map<string, Counter*> CounterList;
71         ///
72         CounterList counterList;
73 };
74
75 #endif