24 #include "Portability.h" 26 #include "StringRef.h" 29 #ifndef DOXYGEN_SHOULD_SKIP_THIS 52 constexpr
explicit Dice(
int faces,
int count = 1,
int modifier = 0)
55 , m_modifier(modifier)
73 while (i < sz &&
'0' <= str[i] && str[i] <=
'9') {
74 m_count = m_count * 10 + (str[i] -
'0');
82 if (str[i] !=
'd' && str[i] !=
'D') {
92 while (i < sz &&
'0' <= str[i] && str[i] <=
'9') {
93 m_faces = m_faces * 10 + (str[i] -
'0');
107 while (i < sz &&
'0' <= str[i] && str[i] <=
'9') {
108 m_modifier = m_modifier * 10 + (str[i] -
'0');
166 constexpr
gf::Dice operator"" _dice(
const char *str, std::size_t sz) {
176 constexpr
gf::Dice operator"" _d4(
unsigned long long int count) {
186 constexpr
gf::Dice operator"" _d6(
unsigned long long int count) {
196 constexpr
gf::Dice operator"" _d8(
unsigned long long int count) {
206 constexpr
gf::Dice operator"" _d10(
unsigned long long int count) {
216 constexpr
gf::Dice operator"" _d12(
unsigned long long int count) {
226 constexpr
gf::Dice operator"" _d20(
unsigned long long int count) {
236 constexpr
gf::Dice operator"" _d100(
unsigned long long int count) {
241 #ifndef DOXYGEN_SHOULD_SKIP_THIS A random engine.
Definition: Random.h:46
constexpr int getCount() const
Get the count of dice.
Definition: Dice.h:127
constexpr int getModifier() const
Get the modifier.
Definition: Dice.h:136
constexpr Dice(int faces, int count=1, int modifier=0)
Constructor.
Definition: Dice.h:52
constexpr int getFaces() const
Get the number of faces.
Definition: Dice.h:118
The namespace for gf classes.
Definition: Action.h:35
constexpr Dice(StringRef str)
Constructor.
Definition: Dice.h:65
A set of dice that can be rolled.
Definition: Dice.h:40
A constant reference to a string and its size.
Definition: StringRef.h:41
constexpr std::size_t getSize() const noexcept
Get the size of the string.
Definition: StringRef.h:136