61c2f8b438
Moved away from QPluginLoader to C/C++ style QLibrary files for the module interface. It's less limiting this way because the host can be built statically and still beable to load non-statically built modules. It's not tested but the i think it should now beable to load modules built on a different version of Qt than the host but the module would must likely need to be build statically. Another change to the module interface makes it so the module can can now also see the host version in CommandLoader::hostRevOk() and decide if the host can continue loading it. The host 'host_info' internal command now displays the version of Qt it was built on. All documentation related to the module interface has been updated. No attempt will be made at the host side to support rev 2 modules so the new minimum rev is now 3. 1.0.2 --> 1.1.2
143 lines
3.3 KiB
C++
143 lines
3.3 KiB
C++
#ifndef MOD_TESTER_H
|
|
#define MOD_TESTER_H
|
|
|
|
// This file is part of MRCI.
|
|
|
|
// MRCI is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
|
|
// MRCI is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with MRCI under the LICENSE.md file. If not, see
|
|
// <http://www.gnu.org/licenses/>.
|
|
|
|
#include <QPluginLoader>
|
|
#include <QtPlugin>
|
|
#include <QObject>
|
|
|
|
#include "command.h"
|
|
|
|
#define IMPORT_REV 3
|
|
|
|
// the import revision is a module compatibility version number
|
|
// used by the host to determine if it can successfully load and
|
|
// run this library or not. as of right now, the host supports rev1
|
|
// and up.
|
|
|
|
#define LIB_VERSION "1.0.1"
|
|
#define LIB_NAME "MRCITestMod"
|
|
|
|
// the versioning system for the library itself can be completely
|
|
// different from the host import revision.
|
|
|
|
#if defined(MOD_TESTER)
|
|
# define MOD_TESTER_EXPORT Q_DECL_EXPORT
|
|
#else
|
|
# define MOD_TESTER_EXPORT Q_DECL_IMPORT
|
|
#endif
|
|
|
|
extern "C" MOD_TESTER_EXPORT CommandLoader *hostImport();
|
|
|
|
QString libName();
|
|
|
|
class Loader : public CommandLoader
|
|
{
|
|
Q_OBJECT
|
|
|
|
private:
|
|
|
|
QString err;
|
|
|
|
public:
|
|
|
|
bool hostRevOk(quint64 minRev, quint16 vMajor, quint16 vMinor, quint16 vPatch);
|
|
quint64 rev();
|
|
ExternCommand *cmdObj(const QString &name);
|
|
QStringList cmdList();
|
|
QString lastError();
|
|
|
|
explicit Loader(QObject *parent = nullptr);
|
|
};
|
|
|
|
//-----------------
|
|
|
|
class ModText : public ExternCommand
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit ModText(QObject *parent = nullptr);
|
|
|
|
void procBin(const SharedObjs *sharedObjs, const QByteArray &data, uchar dType);
|
|
QString shortText();
|
|
QString ioText();
|
|
QString longText();
|
|
QString libText();
|
|
};
|
|
|
|
//--------------------
|
|
|
|
class ModInput : public ExternCommand
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit ModInput(QObject *parent = nullptr);
|
|
|
|
void procBin(const SharedObjs *sharedObjs, const QByteArray &data, uchar dType);
|
|
QString shortText();
|
|
QString ioText();
|
|
QString longText();
|
|
QString libText();
|
|
};
|
|
|
|
//-----------------------
|
|
|
|
class ModLoop : public ExternCommand
|
|
{
|
|
Q_OBJECT
|
|
|
|
private:
|
|
|
|
int index;
|
|
|
|
public:
|
|
|
|
explicit ModLoop(QObject *parent = nullptr);
|
|
|
|
void term();
|
|
void procBin(const SharedObjs *sharedObjs, const QByteArray &data, uchar dType);
|
|
QString shortText();
|
|
QString ioText();
|
|
QString longText();
|
|
QString libText();
|
|
};
|
|
|
|
//--------------------------
|
|
|
|
class ModInherit : public ExternCommand
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit ModInherit(QObject *parent = nullptr);
|
|
|
|
void procBin(const SharedObjs *sharedObjs, const QByteArray &data, uchar dType);
|
|
QString shortText();
|
|
QString ioText();
|
|
QString longText();
|
|
QString libText();
|
|
QStringList internRequest();
|
|
};
|
|
|
|
#endif // MOD_TESTER_H
|