6 #ifdef SIGC_CXX_NAMESPACES
7 using SigC::Connection;
20 void Counter::set(int v)
26 void Counter::addto(int v)
32 int Counter::value() const
53 // We need this since we store the Counter's as pointers in
55 for (CounterList::iterator it = counterList.begin();
56 it != counterList.end();
62 void Counters::newCounter(string const & newc)
64 // First check if newc already exist
65 CounterList::const_iterator cit = counterList.find(newc);
66 // if alrady exist give warning and return
67 if (cit != counterList.end()) {
68 lyxerr << "The new counter already exist." << endl;
71 counterList[newc] = new Counter;
75 void Counters::newCounter(string const & newc, string const & oldc)
77 // First check if newc already exist
78 CounterList::const_iterator cit = counterList.find(newc);
79 // if already existant give warning and return
80 if (cit != counterList.end()) {
81 lyxerr << "The new counter already exist." << endl;
84 // then check if oldc exist
85 CounterList::iterator it = counterList.find(oldc);
86 // if not give warning and return
87 if (it == counterList.end()) {
88 lyxerr << "The old counter does not exist." << endl;
92 Counter * tmp = new Counter;
93 (*it).second->onstep.connect(slot(tmp,
95 counterList[newc] = tmp;
99 void Counters::set(string const & ctr, int val)
101 CounterList::iterator it = counterList.find(ctr);
102 if (it == counterList.end()) {
103 lyxerr << "Counter does not exist." << endl;
106 (*it).second->set(val);
110 void Counters::addto(string const & ctr, int val)
112 CounterList::iterator it = counterList.find(ctr);
113 if (it == counterList.end()) {
114 lyxerr << "Counter does not exist." << endl;
117 (*it).second->addto(val);
121 int Counters::value(string const & ctr) const
123 CounterList::const_iterator cit = counterList.find(ctr);
124 if (cit == counterList.end()) {
125 lyxerr << "Counter does not exist." << endl;
128 return (*cit).second->value();
132 void Counters::step(string const & ctr)
134 CounterList::iterator it = counterList.find(ctr);
135 if (it == counterList.end()) {
136 lyxerr << "Counter does not exist." << endl;
139 (*it).second->step();