VoiceAssistant  main
Resource-efficient, customizable voice assistant
Loading...
Searching...
No Matches
base.h
Go to the documentation of this file.
1#pragma once
2
3#include <QString>
4#include <QtPlugin>
5
6#ifndef NO_BRIDGE
7#include "bridge.h"
8#else
9class PluginBridge;
10#endif
11
19{
20public:
21 virtual ~PluginInterface() = default;
22
28 virtual bool isValid(const QString &input) = 0;
29
34 virtual void run(const QString &input) = 0;
35
43 inline void setBridge(PluginBridge *b)
44 {
45#ifndef NO_BRIDGE
46 bridge = b;
47#endif
48 }
49 PluginBridge *bridge = nullptr;
50};
51
58#define PLUGIN_iid "io.github.tim-gromeyer.voiceassistant.plugin/1.0"
#define PLUGIN_iid
The PLUGIN_iid macro defines the interface ID for the PluginInterface.
Definition: base.h:58
Q_DECLARE_INTERFACE(PluginInterface, PLUGIN_iid)
The PluginBridge class provides a bridge for communication between plugins and the host application.
Definition: bridge.h:21
The PluginInterface class is an abstract interface for plugin functionality.
Definition: base.h:19
virtual bool isValid(const QString &input)=0
isValid checks if a plugin is valid for the given input.
virtual ~PluginInterface()=default
virtual void run(const QString &input)=0
run executes the plugin functionality.
PluginBridge * bridge
Definition: base.h:49
void setBridge(PluginBridge *b)
setBridge sets the bridge for the plugin to communicate with the host application.
Definition: base.h:43