2000-07-17 18:27:53 +00:00
|
|
|
// -*- C++ -*-
|
2000-07-24 13:53:19 +00:00
|
|
|
/* This file is part of
|
2002-03-21 17:27:08 +00:00
|
|
|
* ======================================================
|
|
|
|
*
|
2000-07-24 13:53:19 +00:00
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
|
|
|
* Copyright 1995 Matthias Ettrich
|
2001-05-30 13:53:44 +00:00
|
|
|
* Copyright 1995-2001 The LyX Team.
|
2000-07-24 13:53:19 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* ====================================================== */
|
|
|
|
|
2000-07-17 18:27:53 +00:00
|
|
|
|
|
|
|
#ifndef COUNTERS_H
|
2001-02-12 14:09:09 +00:00
|
|
|
#define COUNTERS_H
|
2000-07-17 18:27:53 +00:00
|
|
|
|
2000-07-24 13:53:19 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2000-07-17 18:27:53 +00:00
|
|
|
#include "LString.h"
|
|
|
|
|
2002-05-29 16:21:03 +00:00
|
|
|
#include <boost/signals/signal0.hpp>
|
|
|
|
#include <boost/signals/trackable.hpp>
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
|
2000-07-17 18:27:53 +00:00
|
|
|
///
|
2002-05-29 16:21:03 +00:00
|
|
|
class Counter : public boost::trackable {
|
2000-07-17 18:27:53 +00:00
|
|
|
public:
|
|
|
|
///
|
|
|
|
Counter();
|
|
|
|
///
|
|
|
|
void set(int v);
|
|
|
|
///
|
|
|
|
void addto(int v);
|
|
|
|
///
|
|
|
|
int value() const;
|
|
|
|
///
|
|
|
|
void step();
|
|
|
|
///
|
|
|
|
void reset();
|
|
|
|
///
|
2002-05-29 16:21:03 +00:00
|
|
|
boost::signal0<void> onstep;
|
2000-07-17 18:27:53 +00:00
|
|
|
private:
|
|
|
|
///
|
|
|
|
int value_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/** This is a class of (La)TeX type counters. The counters is in a text
|
|
|
|
Style and can be reset by signals emitted from a single counter.
|
|
|
|
*/
|
|
|
|
class Counters {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
~Counters();
|
|
|
|
///
|
|
|
|
void newCounter(string const & newc);
|
|
|
|
///
|
|
|
|
void newCounter(string const & newc, string const & oldc);
|
|
|
|
///
|
|
|
|
void set(string const & ctr, int val);
|
|
|
|
///
|
|
|
|
void addto(string const & ctr, int val);
|
|
|
|
///
|
|
|
|
int value(string const & ctr) const;
|
|
|
|
///
|
|
|
|
void step(string const & ctr);
|
|
|
|
// string refstep(string const & cou);
|
|
|
|
private:
|
|
|
|
///
|
|
|
|
typedef std::map<string, Counter*> CounterList;
|
|
|
|
///
|
|
|
|
CounterList counterList;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|