]> vaikene.ee Git - evaf/blobdiff - src/libs/Plugins/pluginmanager.h
Mac OS changes and switched to c++11.
[evaf] / src / libs / Plugins / pluginmanager.h
index 2f320f97b54d0eab2ce57ccae5256976686e8846..91a5b00947db662addc22238846e0dbd2e5fe00e 100644 (file)
@@ -1,8 +1,8 @@
 /**
- * @file plugins/pluginmanager.h
+ * @file Plugins/pluginmanager.h
  * @brief Manager for loadable modules (plugins)
  *
- * Copyright (c) 2011 Enar Vaikene
+ * Copyright (c) 2011-2019 Enar Vaikene
  *
  * This file is part of the eVaf C++ cross-platform application development framework.
  *
 #include <version_rc.h>
 
 #include <QObject>
+#include <QString>
+#include <QScopedPointer>
+
+namespace eVaf {
 
 /**
  * Library for managing loadable modules (plugins).
@@ -44,6 +48,33 @@ namespace Internal {
     class PluginManagerPrivate;
 }
 
+/**
+ * Expands plugin names for the selected platform.
+ * @param name Name of the plugin
+ * @return Expanded plugin name
+ *
+ * This function expands the plugin name so that it becomes valid for the selected platform.
+ * For example, on Linux it adds the prefix "lib" to the beginning and extension ".so" to the end.
+ */
+inline QString expandPluginName(QString const & name)
+{
+#ifdef Q_OS_WIN32
+#  ifdef Q_CC_MINGW
+    return "lib" + name + ".dll";
+#  else
+    return name + ".dll";
+#  endif
+#elif defined Q_OS_LINUX
+    return "lib" + name + ".so";
+#elif defined Q_OS_CYGWIN
+    return "cyg" + name + ".dll";
+#elif defined Q_OS_MACOS
+    return "lib" + name + ".dylib";
+#else
+    return name;
+#endif
+}
+
 /**
  * Plugin manager for eVaf applications.
  */
@@ -101,11 +132,11 @@ signals:
 
 private:
 
-    Internal::PluginManagerPrivate * dl;
+    QScopedPointer<Internal::PluginManagerPrivate> d;
 
 };
 
-} // namespace Plugins
-
+} // namespace eVaf::Plugins
+} // namespace eVaf
 
 #endif // pluginmanager.h