Cockatrice 2026-09-01-Development-3.1.0-beta.10
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
string_limits.h File Reference
#include <QString>
#include <algorithm>
#include <string>
Include dependency graph for string_limits.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

QString nameFromStdString (const std::string &_string)
 Returns a QString from a std::string, truncated to at most MAX_NAME_LENGTH bytes.
QString textFromStdString (const std::string &_string)
 Returns a QString from a std::string, truncated to at most MAX_TEXT_LENGTH bytes.
QString textTailFromStdString (const std::string &_string)
 Returns a QString from a std::string, truncated to at most MAX_TEXT_LENGTH bytes, keeping the tail.
QString fileFromStdString (const std::string &_string)
 Returns a QString from a std::string, truncated to at most MAX_FILE_LENGTH bytes.

Variables

constexpr int MAX_NAME_LENGTH = 0xff
 Max size for short strings, like names and things that are generally a single phrase.
constexpr int MAX_TEXT_LENGTH = 0xfff
 Max size for chat messages and text contents.
constexpr int MAX_FILE_LENGTH = 0x1fffff
 Max size for deck files and pictures (about 2 megabytes).

Function Documentation

◆ fileFromStdString()

QString fileFromStdString ( const std::string & _string)
inline

Returns a QString from a std::string, truncated to at most MAX_FILE_LENGTH bytes.

Here is the caller graph for this function:

◆ nameFromStdString()

QString nameFromStdString ( const std::string & _string)
inline

Returns a QString from a std::string, truncated to at most MAX_NAME_LENGTH bytes.

Here is the caller graph for this function:

◆ textFromStdString()

QString textFromStdString ( const std::string & _string)
inline

Returns a QString from a std::string, truncated to at most MAX_TEXT_LENGTH bytes.

Here is the caller graph for this function:

◆ textTailFromStdString()

QString textTailFromStdString ( const std::string & _string)
inline

Returns a QString from a std::string, truncated to at most MAX_TEXT_LENGTH bytes, keeping the tail.

Here is the caller graph for this function:

Variable Documentation

◆ MAX_FILE_LENGTH

int MAX_FILE_LENGTH = 0x1fffff
constexpr

Max size for deck files and pictures (about 2 megabytes).

◆ MAX_NAME_LENGTH

int MAX_NAME_LENGTH = 0xff
constexpr

Max size for short strings, like names and things that are generally a single phrase.

◆ MAX_TEXT_LENGTH

int MAX_TEXT_LENGTH = 0xfff
constexpr

Max size for chat messages and text contents.