mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-29 09:22:18 -07:00
Updated docstrings
This commit is contained in:
parent
1c7516a3cc
commit
a247f407dd
2 changed files with 11 additions and 5 deletions
|
|
@ -3,9 +3,13 @@
|
|||
|
||||
#include <QtGlobal> // 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
|
||||
|
|
|
|||
|
|
@ -5,22 +5,24 @@
|
|||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
// 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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue