-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrackermap.h
More file actions
33 lines (24 loc) · 774 Bytes
/
trackermap.h
File metadata and controls
33 lines (24 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* Defines a class that stores int values per string keys, tracks
the keys' use or disuse through its slots, and can give a sum
of values of the used keys. */
#ifndef TRACKERMAP_H
#define TRACKERMAP_H
#include <map>
#include <qobject.h>
class QString;
typedef std::map<QString, float> NameToVal;
class TrackerMap : public QObject {
Q_OBJECT
private:
NameToVal trackees;
public:
TrackerMap (QObject * parent = 0) : QObject(parent) {}
void removeKey (QString key); // To add a key, use slot keyUsed.
bool isUsed (QString key) const;
NameToVal::mapped_type value (const QString& key) const; // 0 if unused.
NameToVal::mapped_type total () const;
public slots:
void keyUsed (QString key, float value);
void keyUnused (QString key, float value);
};
#endif