34 template<
typename K,
typename V>
class QHash;
42 #define MUTILS_INTERFACE 2 45 #define MUTILS_BUILD_KEY_HELPER(X,Y) X##" "##Y 46 #define MUTILS_BUILD_KEY MUTILS_BUILD_KEY_HELPER(__DATE__, __TIME__) 50 # ifdef MUTILS_DLL_EXPORT 51 # define MUTILS_API __declspec(dllexport) 53 # ifndef MUTILS_STATIC_LIB 54 # define MUTILS_API __declspec(dllimport) 64 #if defined(_DEBUG) || defined(DEBUG) || (!defined(NDEBUG)) 65 # define MUTILS_DEBUG (1) 66 # if defined(NDEBUG) || defined(QT_NO_DEBUG) || (!defined(QT_DEBUG)) 67 # error Inconsistent DEBUG flags have been detected! 70 # define MUTILS_DEBUG (0) 71 # if (!defined(NDEBUG)) || (!defined(QT_NO_DEBUG)) || defined(QT_DEBUG) 72 # error Inconsistent DEBUG flags have been detected! 77 #if defined(_MSC_VER) && (!defined(__INTELLISENSE__)) && (!defined(_M_X64)) && defined(_M_IX86_FP) 79 #error We should not enabled SSE or SSE2 in release builds! 84 #define MUTILS_GLUE_NAME_HELPER(X,Y) X##Y 85 #define MUTILS_GLUE_NAME(X,Y) MUTILS_GLUE_NAME_HELPER(X,Y) 87 #define MUTILS_INITIALIZER MUTILS_GLUE_NAME(initialize_d, MUTILS_INTERFACE) 89 #define MUTILS_INITIALIZER MUTILS_GLUE_NAME(initialize_r, MUTILS_INTERFACE) 93 #define MUTILS_MAKE_STRING_HELPER(X) #X 94 #define MUTILS_MAKE_STRING(X) MUTILS_MAKE_STRING_HELPER(X) 95 #define MUTILS_COMPILER_WARNING(TXT) __pragma(message(__FILE__ "(" MUTILS_MAKE_STRING(__LINE__) ") : warning: " TXT)) 134 MUTILS_API
void init_process(QProcess &process,
const QString &wokringDir,
const bool bReplaceTempDir =
true,
const QStringList *
const extraPaths = NULL,
const QHash<QString, QString> *
const extraEnv = NULL);
179 MUTILS_API QString
make_temp_file(
const QString &basePath,
const QString &extension,
const bool placeholder =
false);
180 MUTILS_API QString
make_temp_file(
const QDir &basePath,
const QString &extension,
const bool placeholder =
false);
197 MUTILS_API QString
make_unique_file(
const QString &basePath,
const QString &baseName,
const QString &extension,
const bool fancy =
false,
const bool placeholder =
false);
198 MUTILS_API QString
make_unique_file(
const QDir &basePath,
const QString &baseName,
const QString &extension,
const bool fancy =
false,
const bool placeholder =
false);
207 MUTILS_API
bool parity(quint32 value);
218 MUTILS_API
bool remove_file(
const QString &fileName);
231 MUTILS_API
bool remove_directory(
const QString &folderPath,
const bool &recursive);
253 MUTILS_API QString&
trim_left(QString &str);
264 MUTILS_API QString
trim_right(
const QString &str);
275 MUTILS_API QString
trim_left(
const QString &str);
299 MUTILS_API QString
clean_file_name(
const QString &name,
const bool &pretty);
312 MUTILS_API QString
clean_file_path(
const QString &path,
const bool &pretty);
326 MUTILS_API
bool regexp_parse_int32(
const QRegExp ®exp, qint32 &value);
327 MUTILS_API
bool regexp_parse_uint32(
const QRegExp ®exp, quint32 &value,
const size_t &offset);
328 MUTILS_API
bool regexp_parse_int32(
const QRegExp ®exp, qint32 &value,
const size_t &offset);
343 MUTILS_API
bool regexp_parse_uint32(
const QRegExp ®exp, quint32 *values,
const size_t &count);
344 MUTILS_API
bool regexp_parse_int32(
const QRegExp ®exp, qint32 *values,
const size_t &count);
345 MUTILS_API
bool regexp_parse_uint32(
const QRegExp ®exp, quint32 *values,
const size_t &offset,
const size_t &count);
346 MUTILS_API
bool regexp_parse_int32(
const QRegExp ®exp, qint32 *values,
const size_t &offset,
const size_t &count);
373 MUTILS_API
int MUTILS_INITIALIZER(
const unsigned int interfaceId,
const bool debugFlag,
const char *
const buildKey);
374 static const int s_initializedFlag = MUTILS_INITIALIZER(MUTILS_INTERFACE, MUTILS_DEBUG, MUTILS_BUILD_KEY);
382 #define MUTILS_DELETE(PTR) do { if((PTR)) { delete (PTR); (PTR) = NULL; } } while(0) 386 #define MUTILS_DELETE_ARRAY(PTR) do { if((PTR)) { delete [] (PTR); (PTR) = NULL; } } while(0) 390 #define MUTILS_ZERO_MEMORY(PTR) memset(&(PTR), 0, sizeof((PTR))) 394 #define MUTILS_WCHR(STR) (reinterpret_cast<const wchar_t*>((STR).utf16())) 398 #define MUTILS_UTF8(STR) ((STR).toUtf8().constData()) 402 #define MUTILS_L1STR(STR) ((STR).toLatin1().constData()) 406 #define MUTILS_QSTR(STR) (QString::fromUtf16(reinterpret_cast<const unsigned short*>((STR)))) 410 #define MUTILS_BOOL2STR(X) ((X) ? "1" : "0") 414 #define MUTILS_BOOLIFY(X) (!(!(X))) 418 #define MUTILS_ARR2LEN(X) (sizeof((X)) / sizeof((X)[0])) 422 #define MUTILS_NO_COPY(CLASS) \ 423 CLASS(const CLASS &) { throw "Copy constructor is disabled!"; } \ 424 CLASS &operator=(const CLASS &) { throw "Assignment operator is disabled!"; } MUTILS_API QStringList available_codepages(const bool &noAliases=true)
Retrieve a list of all available codepages.
struct MUtils::_fp_parts_t fp_parts_t
This struct containes the parts (integral and fractional part) of a floating-point number...
MUTILS_API QString next_rand_str(const bool &bLong=false)
Generates a random string.
MUTILS_API bool remove_file(const QString &fileName)
Deletes the specified file.
MUTILS_API QString clean_file_path(const QString &path, const bool &pretty)
Clean up a file path string.
This struct containes the parts (integral and fractional part) of a floating-point number...
Definition: Global.h:110
MUTILS_API void natural_string_sort(QStringList &list, const bool bIgnoreCase)
Sort a list of strings using "natural ordering" algorithm.
MUTILS_API bool regexp_parse_uint32(const QRegExp ®exp, quint32 &value)
Parse regular expression results.
MUTILS_API bool parity(quint32 value)
Computes the parity of the given unsigned 32-Bit value.
MUTILS_API fp_parts_t break_fp(const double value)
Break floating-point number into fractional and integral parts.
MUTILS_API quint64 next_rand_u64(void)
Generates a random unsigned 64-Bit value.
MUTILS_API QString & trim_right(QString &str)
Remove trailing white-space characters.
MUTILS_API const QString & temp_folder(void)
Rerieves the full path of the application's Temp folder.
Global MUtils namespace.
Definition: CPUFeatures.h:37
MUTILS_API QString clean_file_name(const QString &name, const bool &pretty)
Clean up a file name string.
MUTILS_API quint32 next_rand_u32(void)
Generates a random unsigned 32-Bit value.
MUTILS_API bool remove_directory(const QString &folderPath, const bool &recursive)
Recursively deletes the specified directory.
MUTILS_API QString make_temp_file(const QString &basePath, const QString &extension, const bool placeholder=false)
Generates a temporary file name.
MUTILS_API void 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.
MUTILS_API QString & trim_left(QString &str)
Remove leading white-space characters.
MUTILS_API QString 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.