-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroller.h
More file actions
36 lines (26 loc) · 920 Bytes
/
Copy pathroller.h
File metadata and controls
36 lines (26 loc) · 920 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
34
35
36
#ifndef ROLLER_H
#define ROLLER_H
#include <QString>
class Roller
{
public:
// Static member function to get the instance of the Singleton class
static Roller& getInstance() {
// Static local variable to ensure it's initialized only once
static Roller instance;
return instance;
}
// Delete copy constructor and assignment operator
Roller(Roller const&) = delete;
void operator=(Roller const&) = delete;
// Roll dice and return the result based on a roll-string
QString roll(QString rollStr, QString &subtotalStr);
// Get the result of rolling a <sides>-sided die <diceCount> times
int roll(int diceCount, int sides, QString &subtotalStr);
// Get the result of rolling a single <sides>-sided die
int rollDie(int sides);
private:
// Private constructor to prevent instantiation of this singleton
Roller() {};
};
#endif // ROLLER_H