Fcitx
|
Base class for any addon in fcitx. More...
#include <fcitx/addoninstance.h>
Public Member Functions | |
virtual void | reloadConfig () |
Reload configuration from disk. | |
virtual void | save () |
Save any relevant data. Usually, it will be invoked when fcitx exits. | |
virtual const Configuration * | getConfig () const |
Get the configuration. | |
virtual void | setConfig (const RawConfig &) |
Set configuration from Raw Config. | |
virtual const Configuration * | getSubConfig (const std::string &) const |
virtual void | setSubConfig (const std::string &, const RawConfig &) |
template<typename Signature , typename... Args> | |
std::function< Signature >::result_type | callWithSignature (const std::string &name, Args &&...args) |
template<typename MetaSignatureString , typename... Args> | |
auto | callWithMetaString (Args &&...args) |
template<typename MetaType , typename... Args> | |
auto | call (Args &&...args) |
Call an exported function for this addon. | |
void | registerCallback (const std::string &name, AddonFunctionAdaptorBase *adaptor) |
Base class for any addon in fcitx.
To implement addon in fcitx, you will need to create a sub class for this class.
To make an SharedLibrary Addon, you will also need to use FCITX_ADDON_FACTORY to export the factory for addon.
An addon can export several function to be invoked by other addons. When you need to do so, you will need some extra command in your CMakeLists.txt, and using FCITX_ADDON_DECLARE_FUNCTION and FCITX_ADDON_EXPORT_FUNCTION.
First you will need to create a header file with exported addon function. E.g. dummyaddon_public.h
This file declares a function addOne for DummyAddon, with function signature int(int).
Then, when you implement the class, add using the macro FCITX_ADDON_EXPORT_FUNCTION to the addon class.
This macro will register the function and check the signature against the actual function to make sure they have the same signature.
In order to invoke the function in other code, you will need to first obtain the pointer to the addon via AddonManager. Then invoke it by
Definition at line 71 of file addoninstance.h.