]> git.lyx.org Git - lyx.git/blob - src/counters.h
Dekels tabular/textinset patches
[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-2000 The LyX Team.
9  *
10  *
11  * ====================================================== */
12
13
14 #ifndef COUNTERS_H
15 #define COUTNERS_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 #ifdef SIGC_CXX_NAMESPACES
26 using SigC::Object;
27 using SigC::Signal0;
28 #endif
29
30
31 ///
32 class Counter : public Object {
33 public:
34         ///
35         Counter();
36         ///
37         void set(int v);
38         ///
39         void addto(int v);
40         ///
41         int value() const;
42         ///
43         void step();
44         ///
45         void reset();
46         ///
47         Signal0<void> onstep;
48 private:
49         ///
50         int value_;
51 };
52
53
54 /** This is a class of (La)TeX type counters. The counters is in a text
55     Style and can be reset by signals emitted from a single counter.
56 */
57 class Counters {
58 public:
59         ///
60         ~Counters();
61         ///
62         void newCounter(string const & newc);
63         ///
64         void newCounter(string const & newc, string const & oldc);
65         ///
66         void set(string const & ctr, int val);
67         ///
68         void addto(string const & ctr, int val);
69         ///
70         int value(string const & ctr) const;
71         ///
72         void step(string const & ctr);
73         // string refstep(string const & cou);
74 private:
75         ///
76         typedef std::map<string, Counter*> CounterList;
77         ///
78         CounterList counterList;
79 };
80
81 #endif