From 688e916955a6b848dbbae1f65ae85a73593ed680 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Enar=20V=C3=A4ikene?= Date: Thu, 21 Apr 2011 12:09:08 +0300 Subject: [PATCH] Added more Common library files. --- src/libs/Common/Event | 1 + src/libs/Common/app.cpp | 132 +++++++++++++++++++++++++++++++ src/libs/Common/app.h | 87 +++++++++++++++++++++ src/libs/Common/event.h | 104 +++++++++++++++++++++++++ src/libs/Common/iApp | 1 + src/libs/Common/iEventQueue | 1 + src/libs/Common/iRegistry | 1 + src/libs/Common/iapp.h | 39 ++++++++++ src/libs/Common/ieventqueue.h | 125 ++++++++++++++++++++++++++++++ src/libs/Common/iregistry.h | 142 ++++++++++++++++++++++++++++++++++ src/libs/Common/registry.cpp | 64 +++++++++++++++ src/libs/Common/registry.h | 70 +++++++++++++++++ src/libs/Common/version.h | 60 ++++++++++++++ src/libs/Common/version.rc | 53 +++++++++++++ 14 files changed, 880 insertions(+) create mode 100644 src/libs/Common/Event create mode 100644 src/libs/Common/app.cpp create mode 100644 src/libs/Common/app.h create mode 100644 src/libs/Common/event.h create mode 100644 src/libs/Common/iApp create mode 100644 src/libs/Common/iEventQueue create mode 100644 src/libs/Common/iRegistry create mode 100644 src/libs/Common/ieventqueue.h create mode 100644 src/libs/Common/iregistry.h create mode 100644 src/libs/Common/registry.cpp create mode 100644 src/libs/Common/registry.h create mode 100644 src/libs/Common/version.h create mode 100644 src/libs/Common/version.rc diff --git a/src/libs/Common/Event b/src/libs/Common/Event new file mode 100644 index 0000000..fe069fc --- /dev/null +++ b/src/libs/Common/Event @@ -0,0 +1 @@ +#include "event.h" diff --git a/src/libs/Common/app.cpp b/src/libs/Common/app.cpp new file mode 100644 index 0000000..6f28942 --- /dev/null +++ b/src/libs/Common/app.cpp @@ -0,0 +1,132 @@ +/** + * @file Common/app.cpp + * @brief Application interface implementation + * @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 "app.h" +#include "globals.h" +#include "registry.h" +#include "ienv.h" +#include "version.h" + +#include + + +//------------------------------------------------------------------- + +using namespace eVaf::Common; + +iApp * iApp::instance() +{ + Internal::App singleton; + return &singleton; +} + +char const * const iApp::EV_QUIT = "iApp::quit"; +char const * const iApp::EV_RESTART = "iApp::restart"; +char const * const iApp::EV_READY = "iApp::ready"; +char const * const iApp::EV_TERMINATING = "iApp::terminating"; + + +//------------------------------------------------------------------- + +using namespace eVaf::Common::Internal; + +App::App() + : iApp() + , mReady(false) + , mName(VER_PRODUCT_NAME_STR) +{ + setObjectName(QString("%1.iApp").arg(VER_MODULE_NAME_STR)); + +} + +App::~App() +{ +} + +bool App::init() +{ + // Register our interface + iRegistry::instance()->registerInterface("iApp", this); + + // Set the default application name and language + mName = VER_PRODUCT_NAME_STR; + mLanguage = QLocale::system().name(); + + // Clear the XML file name + mXmlFile.clear(); + + // Process environment variables + QStringList env = QProcess::systemEnvironment(); + for (int i = 0; i < env.size(); ++i) { + // Get the name/value pair + QString name = env.at(i).section('=', 0, 0).trimmed(); + QString value = env.at(i).section('=', 1).trimmed(); + + if (name == "EVAF_APP_NAME") + mName = value; + else if (name == "EVAF_LANGUAGE") + mLanguage = value; + } + + // Then process command-line arguments + env = QCoreApplication::arguments(); + for (int i = 0; i < env.size(); ++i) { + // Get the name and optional value + QStringList arg = env.at(i).simplified().split('='); + + if (QRegExp("-[-]?app(lication)?").exactMatch(arg.at(0)) && arg.size() > 1) + mName = arg.at(1); + else if (QRegExp("-[-]?lang(uage)?").exactMatch(arg.at(0)) && arg.size() > 1) + mLanguage = arg.at(1); + } +} + +QString const App::xmlFileName() const +{ + if (mXmlFile.isEmpty()) { + QFileInfo fi; + + // Try the full application name + country + language combination + QString name = mName + "_" + mLanguage + ".xml"; + fi.setFile(iEnv::instance()->etcDir() + name); + if (fi.isReadable()) + mXmlFile = name; + else { + // Try application name + country + name = mName + "_" + mLanguage.left(2) + ".xml"; + fi.setFile(iEnv::instance()->etcDir() + name); + if (fi.isReadable()) + mName = name; + else + // Fall-back to the generic name + mXmlFile = mName + ".xml"; + } + } + return mXmlFile; +} + +void App::restart() +{ + QCoreApplication::exit(RC_Restart); +} + +void App::quit(bool err) +{ + QCoreApplication::exit(err ? RC_Error : RC_Quit); +} diff --git a/src/libs/Common/app.h b/src/libs/Common/app.h new file mode 100644 index 0000000..c954641 --- /dev/null +++ b/src/libs/Common/app.h @@ -0,0 +1,87 @@ +/** + * @file Common/app.h + * @brief Application interface implementation + * @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 __COMMON_APP_H +#define __COMMON_APP_H + +#include "iapp.h" + +#include +#include + +namespace eVaf { +namespace Common { +namespace Internal { + +/** + * iApp application interface implementation + */ +class App : public iApp +{ + Q_OBJECT + +public: + + App(); + + virtual ~App(); + + /** + * Initializes the interface implementation + * @return True if ok; false if initialization failed + */ + bool init(); + + /* + iApp interface + */ + virtual QString const name() const { return mName; } + + virtual QString const language() const { return mLanguage; } + + virtual QString const xmlFileName() const; + + virtual void restart(); + + virtual void quit(); + + virtual bool isReady() const { return mReady; } + + +private: + + /// Flag indicating that the eVaf application is ready + bool mReady; + + /// Name of the application + QString mName; + + /// Language for the application + QString mLanguage; + + /// Name of the application's XML file + QString mXmlFile; + +}; + +} // namespace eVaf::Common::Internal +} // namespace eVaf::Common +} // namespace eVaf + +#endif // app.h diff --git a/src/libs/Common/event.h b/src/libs/Common/event.h new file mode 100644 index 0000000..91f33c9 --- /dev/null +++ b/src/libs/Common/event.h @@ -0,0 +1,104 @@ +/** + * @file Common/event.h + * @brief Base class for all the events + * @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 __COMMON_EVENT_H +#define __COMMON_EVENT_H + +#include "libcommon.h" + +#include +#include +#include +#include + +namespace eVaf { +namespace Common { + +/** + * Base class for all the eVaf events + * @code@include @endcode + * + * The Event class is an event container for reference counted data objects. + */ +class COMMON_EXPORT Event : public QEvent +{ +public: + + /// Event type for eVaf events + static QEvent::Type const eVafEvent; + + /** + * Creates the event object + * @param eventId The ID of the event + * @param intValue A 32-bit integer value + * @param dataObj Shared data object attached to the event + * + * Creates the event object with the given event ID value and attaches optional data to the event. + * + * The optional 32-bit integer value can be used to store information that fits into the value and + * is not reference-counted. + * + * The optional reference-counted shared data object is owned by the event and the reference counter + * is decreased by 1 when the event object is destroyed. If nobody else claimed the ownership, then + * the shared data object is destroyed too. + */ + Event(uint eventId, quint32 intValue = 0, QSharedData * dataObj = 0) + : QEvent(eVafEvent) + , mId(eventId) + , mValue(intValue) + , mData(dataObj) + {} + + /** + * Returns the event ID value + */ + inline uint id() const { return mId; } + + /** + * Returns the 32-bit integer value + */ + inline quint32 value() const { return mValue; } + + /** + * Returns the shared data object attached to the event + * + * The shared data object is valid only while in the event handler. Once the event loop + * is finished, the event and shared data attached to it are destroyed. To keep the shared + * data object, use QExplicitlySharedDataPointer<> to claim ownership. + */ + inline QSharedData * data() const { return mData ? mData.data() : 0; } + + +private: + + /// Event ID value + uint mId; + + /// A 32-bit integer value associated to the event + quint32 mValue; + + /// Shared data object attached to the event + QExplicitlySharedDataPointer mData; + +}; + +} // namespace eVaf::Common +} // namespace eVaf + +#endif // event.h diff --git a/src/libs/Common/iApp b/src/libs/Common/iApp new file mode 100644 index 0000000..983a6a6 --- /dev/null +++ b/src/libs/Common/iApp @@ -0,0 +1 @@ +#include "iapp.h" diff --git a/src/libs/Common/iEventQueue b/src/libs/Common/iEventQueue new file mode 100644 index 0000000..363c026 --- /dev/null +++ b/src/libs/Common/iEventQueue @@ -0,0 +1 @@ +#include "ieventqueue.h" diff --git a/src/libs/Common/iRegistry b/src/libs/Common/iRegistry new file mode 100644 index 0000000..e1bad08 --- /dev/null +++ b/src/libs/Common/iRegistry @@ -0,0 +1 @@ +#include "iregistry.h" diff --git a/src/libs/Common/iapp.h b/src/libs/Common/iapp.h index 55269e1..8028589 100644 --- a/src/libs/Common/iapp.h +++ b/src/libs/Common/iapp.h @@ -45,6 +45,25 @@ class COMMON_EXPORT iApp : public QObject public: + /// Application return values + enum { + RC_Quit = 0, ///< Normal exit + RC_Error = 1, ///< Exit due to an error + RC_Restart = 2 ///< The application is restarting + }; + + /// Event that requests the eVaf application to quit + static char const * const EV_QUIT; + + /// Event that requests the eVaf application to restart + static char const * const EV_RESTART; + + /// Event informing that the eVaf application is ready + static char const * const EV_READY; + + /// Event informing that the eVaf application is restarting + static char const * const EV_TERMINATING; + /// Interface constructor iApp() : QObject() {} @@ -101,6 +120,26 @@ public: */ virtual QString const xmlFileName() const = 0; + /** + * Requests the eVaf application to restart. + * + * This function requests the eVaf application to restart itself. Restarting the application + * reloads all the plugins and re-initializes them. + */ + virtual void restart() = 0; + + /** + * Requests the eVaf application to quit. + * + * This function requests the eVaf application to quit. + */ + virtual void quit() = 0; + + /** + * Returns true if the eVaf application is ready. + */ + virtual bool isReady() const = 0; + signals: diff --git a/src/libs/Common/ieventqueue.h b/src/libs/Common/ieventqueue.h new file mode 100644 index 0000000..ce12e42 --- /dev/null +++ b/src/libs/Common/ieventqueue.h @@ -0,0 +1,125 @@ +/** + * @file Common/ieventqueue.h + * @brief Event queue interfaces + * @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 __COMMON_IEVENTQUEUE_H +#define __COMMON_IEVENTQUEUE_H + +#include "libcommon.h" + +#include +#include + +namespace eVaf { +namespace Common { + +/** + * The eVaf event queue interface + * @code#include @endcode + * + * This interface is used to work with eVaf events. Functions in this interface register new events, + * subscribe to existing events and broadcast events to the rest of the application. + * Events are implemented using the Qt event loop. + */ +class COMMON_EXPORT iEventQueue : public QObject +{ + Q_OBJECT + +public: + + /// Interface constructor + iEventQueue() : QObject() {} + + /// Empty virtual destructor + virtual ~iEventQueue() {} + + /** + * Registers an event + * @param name Name of the event + * @return Unique ID of the event + * + * This function registers an event and returns a unique ID for the event. The event ID value + * is always greater than zero. + * + * If an event with the given name already exists, then returns the event ID for the existing + * event. + */ + virtual uint registerEvent(QString const & name) = 0; + + /** + * Queries for an existing event + * @param name Name of the event + * @return The ID of the event or 0 if not found + * + * This function returns the ID of the event or zero if no such event is found. + */ + virtual uint queryEvent(QString const & name) const = 0; + + /** + * Unregisters an event + * @param id The ID of the event + * + * This function removes an event. It also unsubscribes all the subscribers from this event. + */ + virtual void unregisterEvent(uint id) = 0; + + /** + * Subscribes to an event + * @param id The ID of the event (can be zero) + * @param obj The subscriber object + * @param return The ID of the event; or zero if failed to subscribe + * + * This function subscribes to an event identified by the ID value. Every object that wants to + * receive specific events, needs to subscribe to them. + * + * The id parameter can be zero and the following example code is correct even when the event + * called "my-event" does not exist. The value of myEventId will be set to zero if the event + * does not exist. + * @code + * int myEventId = iEventQueue::instance()->subscribeEvent(iEventQueue::instance()->queryEvent("my-event"), this); + * @endcode + */ + virtual uint subscribeEvent(uint id, QObject * obj) = 0; + + /** + * Unsubscribes from an event + * @param id The ID of the event (can be zero) + * @param obj The subscriber object + * + * This function removes the subscriber object from the list of subscribers for the given event identified + * by the event ID value. After this function call the subscriber does no more receive these events. + */ + virtual void unsubscribeEvent(uint id, QObject * obj) = 0; + + /** + * Sends the event to all the subscribers + * @param event The event object + * + * This function sends the event to all the subscribers. The event object is destroyed when the event loop + * is finished for this event. + * + * The event object shall be allocated in the heap. + */ + virtual void broadcastEvent(Event * event) = 0; + +}; + +} // namespace eVaf::Common +} // namespace eVaf + +#endif // ieventqueue.h diff --git a/src/libs/Common/iregistry.h b/src/libs/Common/iregistry.h new file mode 100644 index 0000000..5966746 --- /dev/null +++ b/src/libs/Common/iregistry.h @@ -0,0 +1,142 @@ +/** + * @file Common/iregistry.h + * @brief Common registry for interfaces + * @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 __COMMON_IREGISTRY_H +#define __COMMON_IREGISTRY_H + +#include "libcommon.h" + +#include +#include + +namespace eVaf { +namespace Common { + +/** + * Common registry for interfaces. + * @code#include @endcode + * + * Registry is a central collection of all the eVaf interfaces and iRegistry the interface for it. + * Modules use the iRegistry interface to register new interfaces and query existing ones. + * + * Existing interfaces are queried with the queryInterface() function. The returned pointer to QObject + * shall be type casted to the requested interface class using qobject_cast<>(): + * @code + * iEnv * env = qobject_cast(iRegistry::instance()->queryInterface("iEnv")); + * @endcode + * + * Or use the evafQueryInterface<>() function: + * @code + * iEnv * env = evafQueryInterface("iEnv"); + * @endcode + * + * Registering new interfaces is done with the registerInterface() function as shown in the following example: + * @code + * iRegistry::instance()->registerInterface("iSample", this); + * @endcode + * + * In general, every interface should have a unique name. If an interface is registered with a name that already + * exists, then the new interface overwrites the old interface with the same name. To reimplement an interface, + * query for the old implementation, store it and then register a new interface with the same name. + * + * Any class implementing an interface shall have QObject as their top-most parent. + * + * iRegistry and instance() functions + * + * Most of the interfaces have the instance() function that returns the current instance of the interface. + * The main difference is that by using the instance() function, modules shall link against the module + * that implements the interface's instance() function. The iRegistry interface can be used to get the same + * interface without knowing the module that implements it. + */ +class COMMON_EXPORT iRegistry : public QObject +{ + Q_OBJECT + +public: + + /// Interface constructor + iRegistry() : QObject() {} + + /// Empty virtual destructor + virtual ~iRegistry() {} + + /** + * Returns the iRegistry interface instance + * @return The iRegistry interface + * + * This function returns the global iRegistry interface instance. All eVaf modules and applications + * are expected to be linked against the common library and this is the only method of obtaining + * the iRegistry interface. + */ + static iRegistry * instance(); + + /** + * Registers an interface + * @param name Name of the interface + * @param obj Object implementing the interface + * @return True if ok; false if registering failed + * + * This function registers a new interface in the global registry of interfaces. + * + * If an interface with this name already exists, then the new interface implementation overwrites the old + * implementation. + */ + virtual bool registerInterface(QString const & name, QObject * obj) = 0; + + /** + * Returns the interface by its name + * @param name Name of the interface + * @return Interface implementation or NULL if not found. + * + * This function queries the global registry for the interface by its name. It returns a pointer + * to the implementation of the interface or NULL if no such interface is found. + * + * Use the qobject_cast<>() function to type cast the returned pointer to the required interface class. + * Always check for NULL in case there is a mismatch in interface versions or no such interface is found. + */ + virtual QObject * queryInterface(QString const & name) const = 0; + +}; + +} // namespace eVaf::Common +} // namespace eVaf + +/** + * Helper function for querying interfaces + * @param name Name of the requested interface + * @return The requested interface or NULL if not found + * + * This function can be used to query interfaces from the global registry. It returns a properly + * type-casted interface or NULL if the interface cannot be found or is of an invalid type. + * + * Example: + * @code + * iEnv * env = evafQueryInterface("iEnv"); + * if (env) { + * // Use the interface + * } + * @endcode + */ +template +inline T * evafQueryInterface(QString const & name) +{ + return qobject_cast(eVaf::Common::iRegistry::instance()->queryInterface(name)); +} + +#endif // iregistry.h diff --git a/src/libs/Common/registry.cpp b/src/libs/Common/registry.cpp new file mode 100644 index 0000000..c0f9cae --- /dev/null +++ b/src/libs/Common/registry.cpp @@ -0,0 +1,64 @@ +/** + * @file Common/registry.cpp + * @brief Common registry implementation + * @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 "registry.h" +#include "globals.h" +#include "version.h" + +#include + +//------------------------------------------------------------------- + +using namespace eVaf::Common; + +iRegistry * iRegistry::instance() +{ + static Internal::Registry singleton; + return &singleton; +} + + +//------------------------------------------------------------------- + +using namespace eVaf::Common::Internal; + +Registry::Registry() + : iRegistry() +{ + setObjectName(QString("%1-iRegistry").arg(VER_MODULENAME_STR)); + + // Register our own interface + registerInterface("iRegistry", this); +} + +Registry::~Registry() +{ + mInterfaces.clear(); +} + +bool Registry::registerInterface(QString const & name, QObject * obj) +{ + mInterfaces.insert(name, QPointer(obj)); +} + +QObject * Registry::queryInterface(QString const & name) +{ + QHash >::const_iterator it = mInterfaces.constFind(name); + return it != mInterfaces.constEnd() ? *it : 0; +} diff --git a/src/libs/Common/registry.h b/src/libs/Common/registry.h new file mode 100644 index 0000000..1046c48 --- /dev/null +++ b/src/libs/Common/registry.h @@ -0,0 +1,70 @@ +/** + * @file Common/registry.h + * @brief Common registry implementation + * @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 __COMMON_REGISTRY_H +#define __COMMON_REGISTRY_H + +#include "iregistry.h" + +#include +#include +#include +#include + +namespace eVaf { +namespace Common { +namespace Internal { + +/** + * iRegistry interface implementation. + * + * This class implements the global registry for interfaces. Interfaces are stored in a QHash container + * and quarded with QPointer. + */ +class Registry : public iRegistry +{ + Q_OBJECT + +public: + + Registry(); + + virtual ~Registry(); + + /* + iRegistry interface + */ + + virtual bool registerInterface(QString const & name, QObject * obj); + + virtual QObject * queryInterface(QString const & name) const; + + +private: + + /// All the registered interfaces + QHash > mInterfaces; + +}; + +} // namespace eVaf::Common::Internal +} // namespace eVaf::Common +} // namespace eVaf + +#endif // registry.h diff --git a/src/libs/Common/version.h b/src/libs/Common/version.h new file mode 100644 index 0000000..915e830 --- /dev/null +++ b/src/libs/Common/version.h @@ -0,0 +1,60 @@ +/** + * @file Common/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 __COMMON_VERSION_H +#define __COMMON_VERSION_H + +#include + +/** + * 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 "CommonLib\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 "CommonLib.dll\0" + +/** + * Description of the module/library (shall end with \0) + */ +#define VER_FILE_DESCRIPTION_STR "Library for eVaf applications implementing common interfaces and functions.\0" + +#endif // version.h diff --git a/src/libs/Common/version.rc b/src/libs/Common/version.rc new file mode 100644 index 0000000..7ca43fa --- /dev/null +++ b/src/libs/Common/version.rc @@ -0,0 +1,53 @@ +/** + * @file Common/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 +#include + + +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_FILENAME_STR + VALUE "ProductName", VER_PRODUC_TNAME_STR + VALUE "ProductVersion", VER_PRODUCT_VERSION_STR + VALUE "Module Name", VER_MODULE_NAME_STR + VALUE "Module Type", VER_MODULE_TYPE_STR + END + END + END -- 2.47.0