2019-09-06 23:43:07 -04:00
|
|
|
#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"
|
|
|
|
|
2019-09-22 22:01:07 -04:00
|
|
|
#define IMPORT_REV 3
|
2019-09-06 23:43:07 -04:00
|
|
|
|
|
|
|
// 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.
|
|
|
|
|
2019-09-12 01:29:46 -04:00
|
|
|
#define LIB_VERSION "1.0.1"
|
2019-09-06 23:43:07 -04:00
|
|
|
#define LIB_NAME "MRCITestMod"
|
|
|
|
|
|
|
|
// the versioning system for the library itself can be completely
|
|
|
|
// different from the host import revision.
|
|
|
|
|
2019-09-22 22:01:07 -04:00
|
|
|
#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();
|
|
|
|
|
2019-09-06 23:43:07 -04:00
|
|
|
QString libName();
|
|
|
|
|
2019-09-12 01:29:46 -04:00
|
|
|
class Loader : public CommandLoader
|
2019-09-06 23:43:07 -04:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2019-09-22 22:01:07 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
QString err;
|
2019-09-06 23:43:07 -04:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2019-09-22 22:01:07 -04:00
|
|
|
bool hostRevOk(quint64 minRev, quint16 vMajor, quint16 vMinor, quint16 vPatch);
|
2019-09-06 23:43:07 -04:00
|
|
|
quint64 rev();
|
|
|
|
ExternCommand *cmdObj(const QString &name);
|
|
|
|
QStringList cmdList();
|
2019-09-22 22:01:07 -04:00
|
|
|
QString lastError();
|
2019-09-06 23:43:07 -04:00
|
|
|
|
|
|
|
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
|