#include <QStringList>
#include <QHash>
Go to the source code of this file.
Functions | |
QStringList | char_array_to_stringlist (char **arr, int len) |
QString | ensure_valid_chars (QString str, QString validChars) |
QString | scrub_email_addr (QString email) |
bool | err (QString *str, QString errmsg) |
QString | string_wrap (QString str, int width, QString sep, QString le) |
QString | base16_encode (const QByteArray buf) |
QString | string_escape (const QString str) |
QString | string_unescape (const QString str, bool *ok=0) |
QHash< QString, QString > | string_parse_keyvals (const QString str, bool *ok=0) |
Definition in file string.h.
QString base16_encode | ( | const QByteArray | buf | ) |
Encodes the bytes in buf as an uppercase hexadecimal string and returns the result. This function is derived from base16_encode() in Tor's util.c. See LICENSE for details on Tor's license.
Definition at line 123 of file string.cpp.
References i().
QStringList char_array_to_stringlist | ( | char ** | arr, | |
int | len | |||
) |
Creates a QStringList from the array of C strings.
Create a QStringList from the array of C-style strings.
Definition at line 33 of file string.cpp.
References i().
QString ensure_valid_chars | ( | QString | str, | |
QString | validChars | |||
) |
Ensures all characters in str are in validChars. If a character appears in str but not in validChars, it will be removed and the resulting string returned.
Definition at line 58 of file string.cpp.
References i().
bool err | ( | QString * | str, | |
QString | errmsg | |||
) |
Conditionally assigns errmsg to string if str is not null and returns false.
Conditionally assigns errmsg to str if str is not null and returns false. This is a seemingly pointless function, but it saves some messiness in methods whose QString *errmsg parameter is optional.
Definition at line 46 of file string.cpp.
QString scrub_email_addr | ( | QString | ) |
Scrubs an email address by replacing "@" with " at " and "." with " dot ".
Definition at line 72 of file string.cpp.
QString string_escape | ( | const QString | str | ) |
Given a string str, this function returns a quoted string with all '"' and '\' characters escaped with a single '\'.
Definition at line 136 of file string.cpp.
References i().
QHash<QString,QString> string_parse_keyvals | ( | const QString | str, | |
bool * | ok | |||
) |
Parses a series of space-separated key[=value|="value"] tokens from str and returns the mappings in a QHash. If str was unable to be parsed, ok is set to false.
Definition at line 177 of file string.cpp.
References i(), and string_unescape().
QString string_unescape | ( | const QString | str, | |
bool * | ok | |||
) |
Given a quoted string str, this function returns an unquoted, unescaped string. str must start and end with an unescaped quote.
Definition at line 152 of file string.cpp.
References i().
QString string_wrap | ( | QString | str, | |
int | width, | |||
QString | sep, | |||
QString | le | |||
) |
Wraps str at width characters wide, using sep as the word separator (" ", for example), and placing the line ending le at the end of each line, except the last.
Wraps str at width characters wide, using sep as the word separator (" ", for example), and placing the line ending le at the end of each line, except the last.
Definition at line 84 of file string.cpp.