Soprano
2.9.0
|
Soprano has five kinds of plugins: Soprano::Backend, Soprano::Parser, Soprano::Serializer, Soprano::Query::Parser, and Soprano::Query::Serializer.
Creating a new plugin for Soprano is pretty easy. Imagine, for example, we want to write a new Backend plugin. We simply create a class that inherits from QObject and the Soprano::Backend interface and use the Q_INTERFACES macro to tell Qt's meta-object system about the new plugin. We then export the plugin via the Q_EXPORT_PLUGIN2 macro in the source file.
An example would look as follows:
In the implementation file, export the plugin so that it can be picked up by the plugin loading framework:
The plugin then needs to be linked as a library and installed into the lib/soprano target folder.
Finally we need to create a desktop file describing the plugin. The minimal desktop file looks as follows (for details seeSoprano Plugin Desktop Files):
The desktop file should be installed into share/soprano/plugins so the Soprano::PluginManager will find it.
All plugin interfaces inherit from Soprano::Error::ErrorCache for error handling and subclasses should use Soprano::Error::ErrorCache::clearError() and Soprano::Error::ErrorCache::setError() to report the status.