2012-06-10 16:50:54 +00:00
|
|
|
/*
|
|
|
|
* synergy -- mouse and keyboard sharing utility
|
2014-11-02 12:12:05 +00:00
|
|
|
* Copyright (C) 2012 Synergy Si Ltd.
|
2012-06-10 16:50:54 +00:00
|
|
|
* Copyright (C) 2012 Nick Bolton
|
|
|
|
*
|
|
|
|
* This package is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
2015-05-03 02:33:52 +00:00
|
|
|
* found in the file LICENSE that should have accompanied this file.
|
2012-06-10 16:50:54 +00:00
|
|
|
*
|
|
|
|
* This package is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2014-02-28 12:36:45 +00:00
|
|
|
#include "common/IInterface.h"
|
2015-01-09 13:46:35 +00:00
|
|
|
#include "common/stdmap.h"
|
|
|
|
#include "base/String.h"
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2013-06-29 14:17:49 +00:00
|
|
|
class IEventQueue;
|
|
|
|
|
2012-06-10 16:50:54 +00:00
|
|
|
//! Interface for plugin manager.
|
|
|
|
/*!
|
|
|
|
A plugin manager should load all 3rd party plugins from the plugins dir,
|
|
|
|
and then look for common function names in the plugins.
|
|
|
|
*/
|
|
|
|
class IArchPlugin : public IInterface {
|
|
|
|
public:
|
|
|
|
//! @name manipulators
|
|
|
|
//@{
|
|
|
|
|
2015-01-09 13:46:35 +00:00
|
|
|
//!Load plugins
|
2012-06-10 16:50:54 +00:00
|
|
|
/*!
|
|
|
|
Scan the plugins dir and load plugins.
|
|
|
|
*/
|
2015-01-09 13:46:35 +00:00
|
|
|
virtual void load() = 0;
|
|
|
|
|
2015-01-27 10:42:10 +00:00
|
|
|
//!Unload plugins
|
|
|
|
/*!
|
|
|
|
Look through the loaded plugins and unload them.
|
|
|
|
*/
|
|
|
|
virtual void unload() = 0;
|
|
|
|
|
2015-01-14 17:24:45 +00:00
|
|
|
//! Init the common parts
|
2015-01-09 13:46:35 +00:00
|
|
|
/*!
|
2015-02-13 14:26:03 +00:00
|
|
|
Initializes common parts like log and arch.
|
2015-01-09 13:46:35 +00:00
|
|
|
*/
|
2015-02-13 14:26:03 +00:00
|
|
|
virtual void init(void* log, void* arch) = 0;
|
2015-01-14 17:24:45 +00:00
|
|
|
|
|
|
|
//! Init the event part
|
|
|
|
/*!
|
|
|
|
Initializes event parts.
|
|
|
|
*/
|
|
|
|
virtual void initEvent(void* eventTarget, IEventQueue* events) = 0;
|
2012-06-10 16:50:54 +00:00
|
|
|
|
2015-01-09 13:46:35 +00:00
|
|
|
//! Check if exists
|
|
|
|
/*!
|
|
|
|
Returns true if the plugin exists and is loaded.
|
|
|
|
*/
|
|
|
|
virtual bool exists(const char* name) = 0;
|
|
|
|
|
|
|
|
//! Invoke function
|
|
|
|
/*!
|
|
|
|
Invokes a function from the plugin.
|
|
|
|
*/
|
|
|
|
virtual void* invoke(const char* plugin,
|
|
|
|
const char* command,
|
2015-07-16 19:09:55 +00:00
|
|
|
void** args,
|
|
|
|
void* library = NULL) = 0;
|
2015-01-09 13:46:35 +00:00
|
|
|
|
2012-06-10 16:50:54 +00:00
|
|
|
//@}
|
2015-01-09 13:46:35 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
typedef std::map<String, void*> PluginTable;
|
2012-06-10 16:50:54 +00:00
|
|
|
};
|