19 #ifndef UNITY_SCOPES_SCOPEBASE_H
20 #define UNITY_SCOPES_SCOPEBASE_H
22 #include <unity/scopes/SearchQueryBase.h>
23 #include <unity/scopes/PreviewQueryBase.h>
24 #include <unity/scopes/RegistryProxyFwd.h>
25 #include <unity/scopes/ActivationQueryBase.h>
26 #include <unity/scopes/Version.h>
27 #include <unity/scopes/Result.h>
28 #include <unity/scopes/ActionMetadata.h>
29 #include <unity/scopes/SearchMetadata.h>
34 #define UNITY_SCOPE_CREATE_FUNCTION unity_scope_create
39 #define UNITY_SCOPE_DESTROY_FUNCTION unity_scope_destroy
47 # define UNITY_SCOPE_STR(sym) #sym
48 # define UNITY_SCOPE_XSTR(sym) UNITY_SCOPE_STR(sym)
54 #define UNITY_SCOPE_CREATE_SYMSTR UNITY_SCOPE_XSTR(UNITY_SCOPE_CREATE_FUNCTION)
59 #define UNITY_SCOPE_DESTROY_SYMSTR UNITY_SCOPE_XSTR(UNITY_SCOPE_DESTROY_FUNCTION)
147 static constexpr
int VERSION = UNITY_SCOPES_VERSION_MAJOR;
178 virtual void stop() = 0;
253 static void runtime_version(
int& v_major,
int& v_minor,
int& v_micro) noexcept;
266 std::unique_ptr<internal::ScopeBaseImpl> p;
268 friend class internal::ScopeLoader;
269 friend class internal::RuntimeImpl;
static constexpr int VERSION
This value must be returned from the start() method.
Definition: ScopeBase.h:147
virtual PreviewQueryBase::UPtr preview(Result const &result, ActionMetadata const &metadata)=0
Invoked when a scope is requested to create a preview for a particular result.
static void runtime_version(int &v_major, int &v_minor, int &v_micro) noexcept
Returns the version information for the scopes API that the scope was linked with.
Definition: ScopeBase.cpp:57
virtual SearchQueryBase::UPtr search(CannedQuery const &query, SearchMetadata const &metadata)=0
Called by the scopes run time when a scope needs to instantiate a query.
Base class for a scope implementation.
Definition: ScopeBase.h:136
The attributes of a result returned by a Scope.
Definition: Result.h:51
virtual void stop()=0
Called by the scopes run time when the scope should shut down.
std::string scope_directory() const
Returns directory where the scope files are.
Definition: ScopeBase.cpp:64
virtual int start(std::string const &scope_id, RegistryProxy const ®istry)=0
Called by the scopes run time after the create function completes.
virtual void run()
Called by the scopes run time after it has called start() to hand a thread of control to the scope...
Definition: ScopeBase.cpp:42
#define UNITY_SCOPE_CREATE_FUNCTION
Expands to the identifier of the scope create function.
Definition: ScopeBase.h:34
Parameters of a search query.
Definition: CannedQuery.h:46
decltype(&UNITY_SCOPE_CREATE_FUNCTION) typedef CreateFunction
Convenience typedef for the create function pointer.
Definition: ScopeBase.h:309
#define UNITY_SCOPE_DESTROY_FUNCTION
Expands to the identifier of the scope destroy function.
Definition: ScopeBase.h:39
virtual ActivationQueryBase::UPtr activate(Result const &result, ActionMetadata const &metadata)
Called by the scopes run time when a scope needs to respond to a result activation request...
Definition: ScopeBase.cpp:47
decltype(&UNITY_SCOPE_DESTROY_FUNCTION) typedef DestroyFunction
Convenience typedef for the destroy function pointer.
Definition: ScopeBase.h:314
std::shared_ptr< Registry > RegistryProxy
Convenience type definition.
Definition: RegistryProxyFwd.h:34
virtual ActivationQueryBase::UPtr perform_action(Result const &result, ActionMetadata const &metadata, std::string const &widget_id, std::string const &action_id)
Invoked when a scope is requested to handle a preview action.
Definition: ScopeBase.cpp:52