OSDN Git Service

Added support for Visual Studio 2019.2 (v16.2).
[mutilities/MUtilities.git] / include / MUtils / Global.h
index 0e9aff3..ca7fe75 100644 (file)
@@ -1,6 +1,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 // MuldeR's Utilities for Qt
-// Copyright (C) 2004-2018 LoRd_MuldeR <MuldeR2@GMX.de>
+// Copyright (C) 2004-2019 LoRd_MuldeR <MuldeR2@GMX.de>
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //Forward Declarations
 class QProcess;
 class QDir;
+template<typename K, typename V> class QHash;
 
 ///////////////////////////////////////////////////////////////////////////////
 
 /** \cond INTERNAL
  */
 
+ //Interface version
+#define MUTILS_INTERFACE 3
+
 //MUtils API
 #ifdef _MSC_VER
 #      ifdef MUTILS_DLL_EXPORT
@@ -52,10 +56,6 @@ class QDir;
 #      define MUTILS_API
 #endif
 
-#define MUTILS_MAKE_STRING_HELPER(X) #X
-#define MUTILS_MAKE_STRING(X) MUTILS_MAKE_STRING_HELPER(X)
-#define MUTILS_COMPILER_WARNING(TXT) __pragma(message(__FILE__ "(" MUTILS_MAKE_STRING(__LINE__) ") : warning: " TXT))
-
 //Check Debug Flags
 #if defined(_DEBUG) || defined(DEBUG) || (!defined(NDEBUG))
 #      define MUTILS_DEBUG (1)
@@ -76,6 +76,20 @@ class QDir;
        #endif
 #endif
 
+//Library initializer
+#define MUTILS_GLUE_NAME_HELPER(X,Y) X##Y
+#define MUTILS_GLUE_NAME(X,Y) MUTILS_GLUE_NAME_HELPER(X,Y)
+#if MUTILS_DEBUG
+#define MUTILS_INITIALIZER MUTILS_GLUE_NAME(initialize_d, MUTILS_INTERFACE)
+#else
+#define MUTILS_INITIALIZER MUTILS_GLUE_NAME(initialize_r, MUTILS_INTERFACE)
+#endif
+
+//Compiler warnings
+#define MUTILS_MAKE_STRING_HELPER(X) #X
+#define MUTILS_MAKE_STRING(X) MUTILS_MAKE_STRING_HELPER(X)
+#define MUTILS_COMPILER_WARNING(TXT) __pragma(message(__FILE__ "(" MUTILS_MAKE_STRING(__LINE__) ") : warning: " TXT))
+
 /** \endcond INTERNAL
  */
 
@@ -113,7 +127,7 @@ namespace MUtils
        *
        * \param extraPaths A read-only pointer to a QStringList object containing additional paths that will be added (prepended) to the sub-process' `PATH` environment variable. This parameter can be `NULL`, in which case *no* additional paths are added.
        */
-       MUTILS_API void init_process(QProcess &process, const QString &wokringDir, const bool bReplaceTempDir = true, const QStringList *const extraPaths = NULL);
+       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);
 
        /**
        * \brief Generates a *random* unsigned 32-Bit value.
@@ -123,7 +137,8 @@ namespace MUtils
        * \return The function returns a *random* unsigned 32-Bit value.
        */
        MUTILS_API quint32 next_rand_u32(void);
-       
+       MUTILS_API quint32 next_rand_u32(const quint32 max);
+
        /**
        * \brief Generates a *random* unsigned 64-Bit value.
        *
@@ -348,11 +363,11 @@ namespace MUtils
        */
        MUTILS_API fp_parts_t break_fp(const double value);
 
-       //Internal
+       //Internal (do *not* call directly!)
        namespace Internal
        {
-               MUTILS_API int selfTest(const char *const buildKey, const bool debug);
-               static const int s_selfTest = selfTest(__DATE__ "@" __TIME__, MUTILS_DEBUG);
+               MUTILS_API unsigned int MUTILS_INITIALIZER(const unsigned int interfaceId);
+               static const unsigned int init_flag = MUTILS_INITIALIZER(MUTILS_INTERFACE);
        }
 }