Static Public Member Functions | |
static QString | colorizeString (const QString &str, int def=4) |
static QStringList | combineManyPaths (const QStringList &fronts, const QString &pathEnd) |
Combines path suffix with all fronts, returns new list. More... | |
static QString | combinePaths (QString pathFront, QString pathEnd) |
static QString | createRandomAlphaNumericString (unsigned numChars) |
Creates a random string with specified length. More... | |
static QString | createRandomAlphaNumericStringWithNewLines (unsigned numCharsPerLine, unsigned numLines) |
static const QString & | escape (QString &str) |
Adds escape characters to a string. More... | |
static QString | formatDataAmount (qint64 bytes) |
Similar to formatDataSpeed(). More... | |
static QString | formatDataSpeed (float speedInBytesPerSecond) |
Formats a numerical speed value into a string. More... | |
static QString | formatTime (float seconds) |
Formats a numerical time value into a string. More... | |
static bool | isCharOnCharList (char c, const QString &charList) |
static bool | isUrlSafe (const QString &url) |
Unsafe URLs begin with file:// and this functions returns false for such URLs. More... | |
static QString | normalizePath (QString path) |
Creates a clean path. More... | |
static QByteArray | readUntilByte (QDataStream &stream, unsigned char stopByte) |
This method calls DataStreamOperatorWrapper::readRawUntilByte() . More... | |
static QString | timestamp (const QString &format) |
static void | translateServerAddress (const QString &addressString, QString &hostname, unsigned short &port, const QString &defaultAddress) |
Translates string in format "hostname:port" to atomic values. More... | |
static QString & | trim (QString &str, const QString &charList) |
static QString & | triml (QString &str, const QString &charList) |
static QString & | trimr (QString &str, const QString &charList) |
static const QString & | unescape (QString &str) |
static QString | wrapUrlsWithHtmlATags (const QString &str) |
Detects all links within a given string and wraps them in <a href> tags. More... | |
Protected Types | |
enum | DataUnit { Byte = 0, Kilobyte = 1, Megabyte = 2, Gigabyte = 3 } |
Static Protected Member Functions | |
static float | scaleDataUnit (float bytes, DataUnit &outUnit) |
Static Protected Attributes | |
static const char | RANDOM_CHAR_POOL [RANDOM_CHAR_POOL_SIZE] |
static const unsigned | RANDOM_CHAR_POOL_SIZE = 36 |
Definition at line 39 of file strings.hpp.
|
static |
Colorizes the given string. Most useful for displaying colored names.
Definition at line 50 of file strings.cpp.
|
static |
Combines path suffix with all fronts, returns new list.
This is done by calling combinePaths on all elements of 'fronts' with 'pathEnd' as the second argument.
Definition at line 137 of file strings.cpp.
|
static |
Combines two strings into single path making sure there are no redundant slahes/backslashes present. Paths will be combined using backslash ('\') on Windows systems and slash ('/') on non-Windows systems. Example:
pathFront | - base path |
pathEnd | - part of the path that will be appended |
Definition at line 147 of file strings.cpp.
|
static |
Creates a random string with specified length.
The created string consists of lowercase letters and digits.
Definition at line 171 of file strings.cpp.
|
static |
Adds escape characters to a string.
Definition at line 196 of file strings.cpp.
|
static |
Similar to formatDataSpeed().
The only difference is the unit type appended to the end of the returned string.
Definition at line 219 of file strings.cpp.
|
static |
Formats a numerical speed value into a string.
This expects the parameter to represent speed in bytes per second. Data will be formatted into human readable format, ie. if speed is high enough it will be translated into kilobytes per second or megabytes per second. Also a string representing the type of value is appended: MB/s, kB/s or B/s.
Definition at line 253 of file strings.cpp.
|
static |
Formats a numerical time value into a string.
Parameter is expected to be an amount of seconds. Output is transformed into a number of hours, minutes and seconds. The function will always try to generate the shortest possible string, ie. there will be no hour information if seconds parameter is smaller than 3600. The same goes for minutes. Factorial part in the parameter represents miliseconds and is always rounded up to a full second.
Definition at line 286 of file strings.cpp.
|
static |
Unsafe URLs begin with file:// and this functions returns false for such URLs.
Someone might prepare such URL to make Doomseeker activate files on user's local drive and possibly cause damage to the system.
Definition at line 345 of file strings.cpp.
|
static |
Creates a clean path.
Calls both QDir::fromNativeSeparators() and QDir::cleanPath(). The returned string will have only '/' separators, no '.' or '..' markers and no double separators.
Definition at line 360 of file strings.cpp.
|
static |
This method calls DataStreamOperatorWrapper::readRawUntilByte() .
Definition at line 368 of file strings.cpp.
|
static |
Translates string in format "hostname:port" to atomic values.
addressString | - string to be translated. | |
[out] | hostname | - hostname output. |
[out] | port | - port output. |
defaultHostname | - default hostname to use if translation fails. | |
defaultPort | - default port to use if translation fails or no port inside addressString is specified. |
Definition at line 393 of file strings.cpp.
|
static |
Detects all links within a given string and wraps them in <a href> tags.
Valid URLs are found by seeking continuous no-whitespace substrings starting either with http://, ftp:// or REGEX: www..*+
Furthermore, all URLs that begin with 'www.' will be forced to use the http:// scheme. Leaving them as they are causes problems with opening external URLs in QTextBrowser.
Definition at line 447 of file strings.cpp.
|
staticprotected |
Definition at line 186 of file strings.hpp.