|
@@ -37,6 +37,18 @@ namespace dice {
|
|
|
std::vector<die> of{};
|
|
std::vector<die> of{};
|
|
|
std::vector<mod> modifier{+0};
|
|
std::vector<mod> modifier{+0};
|
|
|
};
|
|
};
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @brief A generator function to turn a string representation of a dice roll into a C++ object
|
|
|
|
|
+ * @param strdice A string representation of a dice roll, represented as one of the
|
|
|
|
|
+ * following expression classes:
|
|
|
|
|
+ * Die = [1-9]?\d*d[1-9]\d*
|
|
|
|
|
+ * SingleRoll: ($Die|\d+)((+|-)($Die|\d+))*
|
|
|
|
|
+ * RepeatRoll: [1-9]\d*\{$SingleRoll\}
|
|
|
|
|
+ * @return a dice object representing the roll
|
|
|
|
|
+ * @throws dice::unexpected_token if a parse failure occurs
|
|
|
|
|
+ */
|
|
|
|
|
+ dice from_string(std::string const & strdice);
|
|
|
|
|
|
|
|
std::ostream & operator<<(std::ostream & out, dice const & d);
|
|
std::ostream & operator<<(std::ostream & out, dice const & d);
|
|
|
std::istream & operator>>(std::istream & out, dice & d);
|
|
std::istream & operator>>(std::istream & out, dice & d);
|