File indexing completed on 2024-09-15 03:44:40
0001 /* 0002 SPDX-FileCopyrightText: 2007 Paolo Capriotti <p.capriotti@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef STATS_H 0008 #define STATS_H 0009 0010 #include <QObject> 0011 0012 struct HitInfo; 0013 0014 class Stats : public QObject 0015 { 0016 Q_OBJECT 0017 int m_hits; 0018 int m_misses; 0019 public: 0020 Stats(); 0021 0022 inline int hits() const { return m_hits; } 0023 void addHit(); 0024 inline int misses() const { return m_misses; } 0025 void addMiss(); 0026 inline int shots() const { return hits() + misses(); } 0027 0028 void addInfo(const HitInfo& info); 0029 0030 int score() const; 0031 0032 void reset(); 0033 0034 Q_SIGNALS: 0035 void hitsChanged(); 0036 void missesChanged(); 0037 }; 0038 0039 #endif // STATS_H 0040