]> vaikene.ee Git - evaf/commitdiff
Added a module for testing the eVaf framework.
authorEnar Väikene <enar.vaikene@mt.com>
Wed, 18 May 2011 12:24:32 +0000 (15:24 +0300)
committerEnar Väikene <enar.vaikene@mt.com>
Wed, 18 May 2011 12:24:32 +0000 (15:24 +0300)
src/CMakeLists.txt
src/plugins/CMakeLists.txt [new file with mode: 0644]
src/plugins/Test/CMakeLists.txt [new file with mode: 0644]
src/plugins/Test/factory.cpp [new file with mode: 0644]
src/plugins/Test/factory.h [new file with mode: 0644]
src/plugins/Test/test.cpp [new file with mode: 0644]
src/plugins/Test/test.h [new file with mode: 0644]
src/plugins/Test/version.h [new file with mode: 0644]
src/plugins/Test/version.rc [new file with mode: 0644]

index acc14c7ac6a0fcc0e25bfa55db4f32eeabc0c02e..79123e72c4352940d72ef09bdeaca44a38f9754d 100644 (file)
@@ -1,3 +1,3 @@
 add_subdirectory(libs)
 add_subdirectory(main)
-#add_subdirectory(plugins)
+add_subdirectory(plugins)
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
new file mode 100644 (file)
index 0000000..1150223
--- /dev/null
@@ -0,0 +1 @@
+add_subdirectory(Test)
diff --git a/src/plugins/Test/CMakeLists.txt b/src/plugins/Test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..35393d7
--- /dev/null
@@ -0,0 +1,36 @@
+# Name of the target
+set(TARGET Test)
+
+# Qt modules
+include(${QT_USE_FILE})
+
+# Include files
+include_directories(${eVaf_INCLUDE})
+
+# Required eVaf libraries
+set(eVaf_LIBRARIES CommonLib PluginsLib)
+
+# Source files
+set(SRCS
+    factory.cpp
+    test.cpp
+)
+
+# Header files for the meta-object compiler
+set(MOC_HDRS
+    factory.h
+    test.h
+)
+
+# Version info resource file for Windows builds
+if(WIN32)
+    set(SRCS ${SRCS} version.rc)
+endif(WIN32)
+
+qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
+
+add_library(${TARGET} SHARED ${SRCS} ${MOC_SRCS})
+
+target_link_libraries(${TARGET} ${QT_LIBRARIES} ${eVaf_LIBRARIES})
+
+install(TARGETS ${TARGET} DESTINATION bin)
diff --git a/src/plugins/Test/factory.cpp b/src/plugins/Test/factory.cpp
new file mode 100644 (file)
index 0000000..feb433f
--- /dev/null
@@ -0,0 +1,62 @@
+/**
+ * @file plugins/Test/factory.cpp
+ * @brief eVaf test plugin factory
+ * @author Enar Vaikene
+ *
+ * Copyright (c) 2011 Enar Vaikene
+ *
+ * This file is part of the eVaf C++ cross-platform application development framework.
+ *
+ * This file can be used under the terms of the GNU General Public License
+ * version 3.0 as published by the Free Software Foundation and appearing in
+ * the file LICENSE included in the packaging of this file. Please review the
+ * the following information to ensure the GNU General Public License version
+ * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
+ *
+ * Alternatively, this file may be used in accordance with the Commercial License
+ * Agreement provided with the Software.
+ */
+
+#include "factory.h"
+#include "test.h"
+#include "version.h"
+
+#include <Common/iLogger>
+
+#include <QtCore>
+
+using namespace eVaf::Test;
+
+VER_EXPORT_VERSION_INFO()
+Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, Factory)
+
+
+//-------------------------------------------------------------------
+
+Factory::Factory()
+    : Plugins::iPluginFactory()
+    , mTest(0)
+{
+    setObjectName(QString("%1-Factory").arg(VER_MODULE_NAME_STR));
+
+    EVAF_INFO("%s created", qPrintable(objectName()));
+}
+
+Factory::~Factory()
+{
+    if (mTest)
+        delete mTest;
+
+    EVAF_INFO("%s destroyed", qPrintable(objectName()));
+}
+
+QObject * Factory::create(QString const & name)
+{
+    if (name == "Test") {
+        if (mTest == 0)
+            mTest = new Internal::TestPlugin;
+        return mTest;
+    }
+    else
+        return 0;
+}
diff --git a/src/plugins/Test/factory.h b/src/plugins/Test/factory.h
new file mode 100644 (file)
index 0000000..2b798a2
--- /dev/null
@@ -0,0 +1,65 @@
+/**
+ * @file plugins/Test/factory.h
+ * @brief eVaf test plugin factory
+ * @author Enar Vaikene
+ *
+ * Copyright (c) 2011 Enar Vaikene
+ *
+ * This file is part of the eVaf C++ cross-platform application development framework.
+ *
+ * This file can be used under the terms of the GNU General Public License
+ * version 3.0 as published by the Free Software Foundation and appearing in
+ * the file LICENSE included in the packaging of this file. Please review the
+ * the following information to ensure the GNU General Public License version
+ * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
+ *
+ * Alternatively, this file may be used in accordance with the Commercial License
+ * Agreement provided with the Software.
+ */
+
+#ifndef __TEST_FACTORY_H
+#define __TEST_FACTORY_H
+
+#include <Plugins/iPluginFactory>
+
+namespace eVaf {
+
+/**
+ * Module for testing the eVaf application framework.
+ */
+namespace Test {
+
+/**
+ * Internal implementation of the test module.
+ */
+namespace Internal {
+    class TestPlugin;
+} // namespace eVaf::Test::Internal
+
+
+/**
+ * Plugin factory class for the test plugin
+ */
+class Factory : public Plugins::iPluginFactory
+{
+    Q_OBJECT
+
+public:
+
+    Factory();
+
+    virtual ~Factory();
+
+    virtual QObject * create(QString const & name);
+
+
+private: // Members
+
+    Internal::TestPlugin * mTest;
+
+};
+
+} // namespace eVaf::Test
+} // namespace eVaf
+
+#endif // factory.h
diff --git a/src/plugins/Test/test.cpp b/src/plugins/Test/test.cpp
new file mode 100644 (file)
index 0000000..e7fb719
--- /dev/null
@@ -0,0 +1,61 @@
+/**
+ * @file plugins/Test/test.cpp
+ * @brief eVaf test plugin
+  * @author Enar Vaikene
+*
+ * Copyright (c) 2011 Enar Vaikene
+ *
+ * This file is part of the eVaf C++ cross-platform application development framework.
+ *
+ * This file can be used under the terms of the GNU General Public License
+ * version 3.0 as published by the Free Software Foundation and appearing in
+ * the file LICENSE included in the packaging of this file. Please review the
+ * the following information to ensure the GNU General Public License version
+ * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
+ *
+ * Alternatively, this file may be used in accordance with the Commercial License
+ * Agreement provided with the Software.
+ */
+
+#include "test.h"
+#include "version.h"
+
+#include <Common/iLogger>
+
+#include <QtCore>
+
+using namespace eVaf;
+using namespace eVaf::Test::Internal;
+
+
+//-------------------------------------------------------------------
+
+TestPlugin::TestPlugin()
+    : Plugins::iPlugin()
+    , mReady(false)
+{
+    setObjectName(QString("%1-TestPlugin").arg(VER_MODULE_NAME_STR));
+
+    EVAF_INFO("%s created", qPrintable(objectName()));
+}
+
+TestPlugin::~TestPlugin()
+{
+    EVAF_INFO("%s destroyed", qPrintable(objectName()));
+}
+
+bool TestPlugin::init(QString const & args)
+{
+    mReady = true;
+
+    EVAF_INFO("%s initialized", qPrintable(objectName()));
+
+    return true;
+}
+
+void TestPlugin::done()
+{
+    mReady = false;
+
+    EVAF_INFO("%s finalized", qPrintable(objectName()));
+}
diff --git a/src/plugins/Test/test.h b/src/plugins/Test/test.h
new file mode 100644 (file)
index 0000000..35630cd
--- /dev/null
@@ -0,0 +1,63 @@
+/**
+ * @file plugins/Test/test.h
+ * @brief eVaf test plugin
+  * @author Enar Vaikene
+*
+ * Copyright (c) 2011 Enar Vaikene
+ *
+ * This file is part of the eVaf C++ cross-platform application development framework.
+ *
+ * This file can be used under the terms of the GNU General Public License
+ * version 3.0 as published by the Free Software Foundation and appearing in
+ * the file LICENSE included in the packaging of this file. Please review the
+ * the following information to ensure the GNU General Public License version
+ * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
+ *
+ * Alternatively, this file may be used in accordance with the Commercial License
+ * Agreement provided with the Software.
+ */
+
+#ifndef __TEST_TEST_H
+#define __TEST_TEST_H
+
+#include <Plugins/iPlugin>
+
+#include <QObject>
+#include <QString>
+
+namespace eVaf {
+
+namespace Test {
+namespace Internal {
+
+/**
+ * Test module
+ */
+class TestPlugin : public Plugins::iPlugin
+{
+    Q_OBJECT
+
+public:
+
+    TestPlugin();
+
+    virtual ~TestPlugin();
+
+    virtual bool init(QString const & args);
+
+    virtual void done();
+
+    virtual bool isReady() const { return mReady; }
+
+
+private: // Members
+
+    bool mReady;
+
+};
+
+} // namespace eVaf::Test::Internal
+} // namespace eVaf::Test
+} // namespace eVaf
+
+#endif // test.h
diff --git a/src/plugins/Test/version.h b/src/plugins/Test/version.h
new file mode 100644 (file)
index 0000000..d288dbc
--- /dev/null
@@ -0,0 +1,60 @@
+/**
+ * @file plugins/Test/version.h
+ * @brief Version information for eVaf modules
+ * @author Enar Vaikene
+ *
+ * Copyright (c) 2011 Enar Vaikene
+ *
+ * This file is part of the eVaf C++ cross-platform application development framework.
+ *
+ * This file can be used under the terms of the GNU General Public License
+ * version 3.0 as published by the Free Software Foundation and appearing in
+ * the file LICENSE included in the packaging of this file. Please review the
+ * the following information to ensure the GNU General Public License version
+ * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
+ *
+ * Alternatively, this file may be used in accordance with the Commercial License
+ * Agreement provided with the Software.
+ */
+
+#ifndef __TEST_VERSION_H
+#define __TEST_VERSION_H
+
+#include <version_rc.h>
+
+/**
+ * Module/library version number in the form major,minor,release,build
+ */
+#define VER_FILE_VERSION                0,1,1,1
+
+/**
+ * Module/library version number in the string format (shall end with \0)
+ */
+#define VER_FILE_VERSION_STR            "0.1.1.1\0"
+
+/**
+ * Module/library name (shall end with \0)
+ */
+#define VER_MODULE_NAME_STR             "Test\0"
+
+/**
+ * Module type (see version_rc.h for all the types)
+ */
+#define VER_MODULE_TYPE                 MT_GENERIC
+
+/**
+ * Module type in the string format (see version_rc for all the types)
+ */
+#define VER_MODULE_TYPE_STR             MT_GENERIC
+
+/**
+ * Original file name for windows (shall end with \0)
+ */
+#define VER_ORIGINAL_FILE_NAME_STR      "Test.dll\0"
+
+/**
+ * Description of the module/library (shall end with \0)
+ */
+#define VER_FILE_DESCRIPTION_STR         "Module for testing eVaf application framework.\0"
+
+#endif // version.h
diff --git a/src/plugins/Test/version.rc b/src/plugins/Test/version.rc
new file mode 100644 (file)
index 0000000..1ca9b4c
--- /dev/null
@@ -0,0 +1,54 @@
+/**
+ * @file plugins/Test/version.rc
+ * @brief Windows resource file with module/library version information.
+ * @author Enar Vaikene
+ *
+ * Copyright (c) 2011 Enar Vaikene
+ *
+ * This file is part of the eVaf C++ cross-platform application development framework.
+ *
+ * This file can be used under the terms of the GNU General Public License
+ * version 3.0 as published by the Free Software Foundation and appearing in
+ * the file LICENSE included in the packaging of this file. Please review the
+ * the following information to ensure the GNU General Public License version
+ * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
+ *
+ * Alternatively, this file may be used in accordance with the Commercial License
+ * Agreement provided with the Software.
+ */
+
+#include "version.h"
+#include <version_rc.h>
+#include <winver.h>
+
+
+VS_VERSION_INFO VERSIONINFO
+        FILEVERSION VER_FILE_VERSION
+        PRODUCTVERSION VER_PRODUCT_VERSION
+        FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+        FILEFLAGS VS_FF_DEBUG
+#else
+        FILEFLAGS 0x0L
+#endif
+        FILEOS VOS__WINDOWS32
+        FILETYPE VFT_DLL
+        FILESUBTYPE 0x0L
+        BEGIN
+                BLOCK "StringFileInfo"
+                BEGIN
+                        BLOCK "040904B0"
+                        BEGIN
+                                VALUE "CompanyName", VER_COMPANY_NAME_STR
+                                VALUE "FileDescription", VER_FILE_DESCRIPTION_STR
+                                VALUE "FileVersion", VER_FILE_VERSION_STR
+                                VALUE "LegalCopyright", VER_LEGAL_COPYRIGHT_STR
+                                VALUE "OriginalFilename", VER_ORIGINAL_FILE_NAME_STR
+                                VALUE "ProductName", VER_PRODUCT_NAME_STR
+                                VALUE "ProductVersion", VER_PRODUCT_VERSION_STR
+                                VALUE "Build Date", VER_PRODUCT_DATE_STR
+                                VALUE "Module Name", VER_MODULE_NAME_STR
+                                VALUE "Module Type", VER_MODULE_TYPE_STR
+                        END
+                END
+        END