diff --git a/libcockatrice_utility/libcockatrice/utility/dice_limits.h b/libcockatrice_utility/libcockatrice/utility/dice_limits.h index 55ca7a52f..e1407c57e 100644 --- a/libcockatrice_utility/libcockatrice/utility/dice_limits.h +++ b/libcockatrice_utility/libcockatrice/utility/dice_limits.h @@ -3,9 +3,13 @@ #include // for uint +/** @brief Fewest sides a rollable die may have. */ constexpr uint MINIMUM_DIE_SIDES = 2; +/** @brief Most sides a rollable die may have. */ constexpr uint MAXIMUM_DIE_SIDES = 1000000; +/** @brief Fewest dice that may be rolled at once. */ constexpr uint MINIMUM_DICE_TO_ROLL = 1; +/** @brief Most dice that may be rolled at once. */ constexpr uint MAXIMUM_DICE_TO_ROLL = 100; #endif // DICE_LIMITS_H diff --git a/libcockatrice_utility/libcockatrice/utility/string_limits.h b/libcockatrice_utility/libcockatrice/utility/string_limits.h index 93d264659..cca804bf0 100644 --- a/libcockatrice_utility/libcockatrice/utility/string_limits.h +++ b/libcockatrice_utility/libcockatrice/utility/string_limits.h @@ -5,22 +5,24 @@ #include #include -// max size for short strings, like names and things that are generally a single phrase +/** @brief Max size for short strings, like names and things that are generally a single phrase. */ constexpr int MAX_NAME_LENGTH = 0xff; -// max size for chat messages and text contents +/** @brief Max size for chat messages and text contents. */ constexpr int MAX_TEXT_LENGTH = 0xfff; -// max size for deck files and pictures -constexpr int MAX_FILE_LENGTH = 0x1fffff; // about 2 megabytes +/** @brief Max size for deck files and pictures (about 2 megabytes). */ +constexpr int MAX_FILE_LENGTH = 0x1fffff; -// optimized functions to get qstrings that are at most that long +/** @brief Returns a QString from a std::string, truncated to at most MAX_NAME_LENGTH bytes. */ inline QString nameFromStdString(const std::string &_string) { return QString::fromUtf8(_string.data(), std::min(int(_string.size()), MAX_NAME_LENGTH)); } +/** @brief Returns a QString from a std::string, truncated to at most MAX_TEXT_LENGTH bytes. */ inline QString textFromStdString(const std::string &_string) { return QString::fromUtf8(_string.data(), std::min(int(_string.size()), MAX_TEXT_LENGTH)); } +/** @brief Returns a QString from a std::string, truncated to at most MAX_FILE_LENGTH bytes. */ inline QString fileFromStdString(const std::string &_string) { return QString::fromUtf8(_string.data(), std::min(int(_string.size()), MAX_FILE_LENGTH));