Test CRTP.

This commit is contained in:
Gerhard Hoffmann 2023-11-24 13:45:11 +01:00
parent 9fa37d125d
commit 4b38e2e46e
3 changed files with 21 additions and 17 deletions

View File

@ -7,6 +7,9 @@
#include <QObject> #include <QObject>
#include <QStringList> #include <QStringList>
class UnifiedDCVMCInterface;
template <typename T>
struct ATBAPPplugin { struct ATBAPPplugin {
enum class PLUGIN_STATE : quint8 { enum class PLUGIN_STATE : quint8 {
NOT_INITIALIZED = 0, NOT_INITIALIZED = 0,
@ -54,14 +57,14 @@ struct ATBAPPplugin {
} }
}; };
using PLUGIN_STATE = ATBAPPplugin::PLUGIN_STATE; using PLUGIN_STATE = ATBAPPplugin<UnifiedDCVMCInterface>::PLUGIN_STATE;
using RESULT_STATE = ATBAPPplugin::RESULT_STATE; using RESULT_STATE = ATBAPPplugin<UnifiedDCVMCInterface>::RESULT_STATE;
using CASH_STATE = ATBAPPplugin::CASH_STATE; using CASH_STATE = ATBAPPplugin<UnifiedDCVMCInterface>::CASH_STATE;
using TICKET_VARIANT = ATBAPPplugin::TICKET_VARIANT; using TICKET_VARIANT = ATBAPPplugin<UnifiedDCVMCInterface>::TICKET_VARIANT;
using STEP = ATBAPPplugin::STEP; using STEP = ATBAPPplugin<UnifiedDCVMCInterface>::STEP;
using TERMINAL_STATE = ATBAPPplugin::TERMINAL_STATE; using TERMINAL_STATE = ATBAPPplugin<UnifiedDCVMCInterface>::TERMINAL_STATE;
Q_DECLARE_INTERFACE(ATBAPPplugin, //Q_DECLARE_INTERFACE(ATBAPPplugin,
"eu.atb.ptu.plugin.ATBAPPplugin/0.9") // "eu.atb.ptu.plugin.ATBAPPplugin/0.9")
#endif // ATBAPPPLUGIN_H #endif // ATBAPPPLUGIN_H

View File

@ -12,9 +12,9 @@
#include "ATBAPPplugin.h" #include "ATBAPPplugin.h"
class UnifiedDCVMCInterface : public ATBAPPplugin { class UnifiedDCVMCInterface : public ATBAPPplugin<UnifiedDCVMCInterface> {
Q_INTERFACES(ATBAPPplugin) //Q_INTERFACES(ATBAPPplugin)
Q_CLASSINFO("Interface", "ATBAPPplugin") //Q_CLASSINFO("Interface", "ATBAPPplugin")
public: public:
explicit UnifiedDCVMCInterface() = default; explicit UnifiedDCVMCInterface() = default;
@ -45,7 +45,7 @@ public:
virtual QString const &getString(RESULT_STATE resultState) = 0; virtual QString const &getString(RESULT_STATE resultState) = 0;
public slots: //public slots:
virtual void onChangedProgramModeToSELL() = 0; virtual void onChangedProgramModeToSELL() = 0;
virtual void onChangedProgramModeToSERVICE() = 0; virtual void onChangedProgramModeToSERVICE() = 0;
virtual void onChangedProgramModeToIDLE() = 0; virtual void onChangedProgramModeToIDLE() = 0;
@ -57,7 +57,7 @@ public slots:
virtual void reset() = 0; virtual void reset() = 0;
}; };
Q_DECLARE_INTERFACE(UnifiedDCVMCInterface, //Q_DECLARE_INTERFACE(UnifiedDCVMCInterface,
"eu.atb.ptu.plugin.UnifiedDCVMCInterface/1.0") // "eu.atb.ptu.plugin.UnifiedDCVMCInterface/1.0")
#endif // UNIFIED_DCVMC_INTERFACE_H_INCLUDED #endif // UNIFIED_DCVMC_INTERFACE_H_INCLUDED

View File

@ -20,9 +20,10 @@ namespace nsVMCInterface {
class VMCInterface : public QObject, public UnifiedDCVMCInterface { class VMCInterface : public QObject, public UnifiedDCVMCInterface {
Q_OBJECT Q_OBJECT
Q_INTERFACES(ATBAPPplugin UnifiedDCVMCInterface) //Q_INTERFACES(ATBAPPplugin UnifiedDCVMCInterface)
Q_CLASSINFO("Interface", "ATBAPPplugin") //Q_INTERFACES(UnifiedDCVMCInterface)
Q_CLASSINFO("Interface", "UnifiedDCVMCInterface") //Q_CLASSINFO("Interface", "ATBAPPplugin")
//Q_CLASSINFO("Interface", "UnifiedDCVMCInterface")
public: public:
explicit VMCInterface(QObject *parent = nullptr) : QObject(parent) {} explicit VMCInterface(QObject *parent = nullptr) : QObject(parent) {}