This file contains miscellaneous functions that are generally useful for Qt-based applications.
More...
|
#define | MUTILS_DELETE(PTR) do { if((PTR)) { delete (PTR); (PTR) = NULL; } } while(0) |
| Deletes the object, if and only if the given pointer is not NULL. Also sets pointer to NULL after object has been deleted.
|
|
#define | MUTILS_DELETE_ARRAY(PTR) do { if((PTR)) { delete [] (PTR); (PTR) = NULL; } } while(0) |
| Deletes the array, if and only if the given pointer is not NULL. Also sets pointer to NULL after array has been deleted.
|
|
#define | MUTILS_ZERO_MEMORY(PTR) memset(&(PTR), 0, sizeof((PTR))) |
| Clears the specified variable or struct by setting all of its bytes to zero (0x00 ). Do not use for arrays.
|
|
#define | MUTILS_WCHR(STR) (reinterpret_cast<const wchar_t*>((STR).utf16())) |
| Converts a given QString object to a wchar_t* pointer. Does not copy the string data, so do not free the pointer! The returned pointer only remains valid until the underlying QString is modified or goes out of scope.
|
|
#define | MUTILS_UTF8(STR) ((STR).toUtf8().constData()) |
| Converts a given QString object to a char* pointer. The string is converted to UTF-8 encoding. The pointer is valid only while the expression is being evaluated, so do not free or store this pointer! Mainly useful for function calls that require a char* argument.
|
|
#define | MUTILS_L1STR(STR) ((STR).toLatin1().constData()) |
| Converts a given QString object to a char* pointer. The string is converted to Latin-1 encoding. The pointer is valid only while the expression is being evaluated, so do not free or store this pointer! Mainly useful for function calls that require a char* argument.
|
|
#define | MUTILS_QSTR(STR) (QString::fromUtf16(reinterpret_cast<const unsigned short*>((STR)))) |
| Creates a QString object from a given wchar_t* buffer. The buffer is expected to conatin a NULL-terminated string in UTF-16 encoding. The string data is copied into the new QString object, however the original buffer will not be freed automatically!
|
|
#define | MUTILS_BOOL2STR(X) ((X) ? "1" : "0") |
| Converts a boolean expression into a string. A true boolean expression is converted to the string "1" ; a false boolean expression is converted to the string "0" .
|
|
#define | MUTILS_BOOLIFY(X) (!(!(X))) |
| Converts a given expression into a boolean expression, by application of double negation operator.
|
|
#define | MUTILS_ARR2LEN(X) (sizeof((X)) / sizeof((X)[0])) |
| Get length of an array, only works with local array variables!
|
|
#define | MUTILS_NO_COPY(CLASS) |
| Disables copy constructor and assignment operator in the specified class. This macro should be used in the "private" section of the class' declaration. More...
|
|
|
MUTILS_API const QString & | MUtils::temp_folder (void) |
| Rerieves the full path of the application's Temp folder. More...
|
|
MUTILS_API void | MUtils::init_process (QProcess &process, const QString &wokringDir, const bool bReplaceTempDir=true, const QStringList *const extraPaths=NULL, const QHash< QString, QString > *const extraEnv=NULL) |
| Initialize a given QProcess object. More...
|
|
MUTILS_API quint32 | MUtils::next_rand_u32 (void) |
| Generates a random unsigned 32-Bit value. More...
|
|
MUTILS_API quint32 | MUtils::next_rand_u32 (const quint32 max) |
|
MUTILS_API quint64 | MUtils::next_rand_u64 (void) |
| Generates a random unsigned 64-Bit value. More...
|
|
MUTILS_API QString | MUtils::next_rand_str (const bool &bLong=false) |
| Generates a random string. More...
|
|
MUTILS_API QString | MUtils::make_temp_file (const QString &basePath, const QString &extension, const bool placeholder=false) |
| Generates a temporary file name. More...
|
|
MUTILS_API QString | MUtils::make_temp_file (const QDir &basePath, const QString &extension, const bool placeholder=false) |
|
MUTILS_API QString | MUtils::make_unique_file (const QString &basePath, const QString &baseName, const QString &extension, const bool fancy=false, const bool placeholder=false) |
| Generates a unique file name. More...
|
|
MUTILS_API QString | MUtils::make_unique_file (const QDir &basePath, const QString &baseName, const QString &extension, const bool fancy=false, const bool placeholder=false) |
|
MUTILS_API bool | MUtils::parity (quint32 value) |
| Computes the parity of the given unsigned 32-Bit value. More...
|
|
MUTILS_API bool | MUtils::remove_file (const QString &fileName) |
| Deletes the specified file. More...
|
|
MUTILS_API bool | MUtils::remove_directory (const QString &folderPath, const bool &recursive) |
| Recursively deletes the specified directory. More...
|
|
MUTILS_API QString & | MUtils::trim_right (QString &str) |
| Remove trailing white-space characters. More...
|
|
MUTILS_API QString & | MUtils::trim_left (QString &str) |
| Remove leading white-space characters. More...
|
|
MUTILS_API QString | MUtils::trim_right (const QString &str) |
| Remove trailing white-space characters. More...
|
|
MUTILS_API QString | MUtils::trim_left (const QString &str) |
| Remove trailing white-space characters. More...
|
|
MUTILS_API void | MUtils::natural_string_sort (QStringList &list, const bool bIgnoreCase) |
| Sort a list of strings using "natural ordering" algorithm. More...
|
|
MUTILS_API QString | MUtils::clean_file_name (const QString &name, const bool &pretty) |
| Clean up a file name string. More...
|
|
MUTILS_API QString | MUtils::clean_file_path (const QString &path, const bool &pretty) |
| Clean up a file path string. More...
|
|
MUTILS_API bool | MUtils::regexp_parse_uint32 (const QRegExp ®exp, quint32 &value) |
| Parse regular expression results. More...
|
|
MUTILS_API bool | MUtils::regexp_parse_int32 (const QRegExp ®exp, qint32 &value) |
|
MUTILS_API bool | MUtils::regexp_parse_uint32 (const QRegExp ®exp, quint32 &value, const size_t &offset) |
|
MUTILS_API bool | MUtils::regexp_parse_int32 (const QRegExp ®exp, qint32 &value, const size_t &offset) |
|
MUTILS_API QString | MUtils::parent_path (const QString &path) |
| Get parent path. More...
|
|
MUTILS_API bool | MUtils::regexp_parse_uint32 (const QRegExp ®exp, quint32 *values, const size_t &count) |
| Parse regular expression results. More...
|
|
MUTILS_API bool | MUtils::regexp_parse_int32 (const QRegExp ®exp, qint32 *values, const size_t &count) |
|
MUTILS_API bool | MUtils::regexp_parse_uint32 (const QRegExp ®exp, quint32 *values, const size_t &offset, const size_t &count) |
|
MUTILS_API bool | MUtils::regexp_parse_int32 (const QRegExp ®exp, qint32 *values, const size_t &offset, const size_t &count) |
|
MUTILS_API QStringList | MUtils::available_codepages (const bool &noAliases=true) |
| Retrieve a list of all available codepages. More...
|
|
MUTILS_API fp_parts_t | MUtils::break_fp (const double value) |
| Break floating-point number into fractional and integral parts. More...
|
|
This file contains miscellaneous functions that are generally useful for Qt-based applications.