Fix keymap.
[vuplus_xbmc] / xbmc / addons / DllLibCPluff.h
1 #pragma once
2 /*
3  *      Copyright (C) 2005-2013 Team XBMC
4  *      http://xbmc.org
5  *
6  *  This Program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2, or (at your option)
9  *  any later version.
10  *
11  *  This Program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with XBMC; see the file COPYING.  If not, see
18  *  <http://www.gnu.org/licenses/>.
19  *
20  */
21
22 #include "DynamicDll.h"
23
24 extern "C" {
25 #include "lib/cpluff/libcpluff/cpluff.h"
26 }
27
28 class DllLibCPluffInterface
29 {
30 public:
31   virtual ~DllLibCPluffInterface() {}
32   virtual const char *get_version(void) =0;
33   virtual void set_fatal_error_handler(cp_fatal_error_func_t error_handler) =0;
34   virtual cp_status_t init(void) =0;
35   virtual void destroy(void) =0;
36   virtual cp_context_t * create_context(cp_status_t *status) =0;
37   virtual void destroy_context(cp_context_t *ctx) =0;
38   virtual cp_status_t register_pcollection(cp_context_t *ctx, const char *dir) =0;
39   virtual void unregister_pcollection(cp_context_t *ctx, const char *dir) =0;
40   virtual void unregister_pcollections(cp_context_t *ctx) =0;
41   virtual cp_status_t register_logger(cp_context_t *ctx, cp_logger_func_t logger, void *user_data, cp_log_severity_t min_severity) =0;
42   virtual void unregister_logger(cp_context_t *ctx, cp_logger_func_t logger) =0;
43   virtual cp_status_t scan_plugins(cp_context_t *ctx, int flags) =0;
44   virtual cp_plugin_info_t * get_plugin_info(cp_context_t *ctx, const char *id, cp_status_t *status) =0;
45   virtual cp_plugin_info_t ** get_plugins_info(cp_context_t *ctx, cp_status_t *status, int *num) =0;
46   virtual cp_extension_t ** get_extensions_info(cp_context_t *ctx, const char *extpt_id, cp_status_t *status, int *num) =0;
47   virtual void release_info(cp_context_t *ctx, void *info) =0;
48   virtual cp_cfg_element_t * lookup_cfg_element(cp_cfg_element_t *base, const char *path) =0;
49   virtual char * lookup_cfg_value(cp_cfg_element_t *base, const char *path) =0;
50   virtual cp_status_t define_symbol(cp_context_t *ctx, const char *name, void *ptr) =0;
51   virtual void *resolve_symbol(cp_context_t *ctx, const char *id, const char *name, cp_status_t *status) =0;
52   virtual void release_symbol(cp_context_t *ctx, const void *ptr) =0;
53   virtual cp_plugin_info_t *load_plugin_descriptor(cp_context_t *ctx, const char *path, cp_status_t *status) =0;
54   virtual cp_plugin_info_t *load_plugin_descriptor_from_memory(cp_context_t *ctx, const char *buffer, unsigned int buffer_len, cp_status_t *status) =0;
55   virtual cp_status_t uninstall_plugin(cp_context_t *ctx, const char *id)=0;
56 };
57
58 class DllLibCPluff : public DllDynamic, DllLibCPluffInterface
59 {
60   DECLARE_DLL_WRAPPER(DllLibCPluff, DLL_PATH_CPLUFF)
61   DEFINE_METHOD0(const char*,         get_version)
62   DEFINE_METHOD1(void,                set_fatal_error_handler,  (cp_fatal_error_func_t p1))
63   DEFINE_METHOD0(cp_status_t,         init)
64   DEFINE_METHOD0(void,                destroy)
65   DEFINE_METHOD1(cp_context_t*,       create_context,           (cp_status_t *p1))
66   DEFINE_METHOD1(void,                destroy_context,          (cp_context_t *p1))
67
68   DEFINE_METHOD2(cp_status_t,         register_pcollection,     (cp_context_t *p1, const char *p2))
69   DEFINE_METHOD2(void,                unregister_pcollection,   (cp_context_t *p1, const char *p2))
70   DEFINE_METHOD1(void,                unregister_pcollections,  (cp_context_t *p1))
71
72   DEFINE_METHOD4(cp_status_t,         register_logger,          (cp_context_t *p1, cp_logger_func_t p2, void *p3, cp_log_severity_t p4))
73   DEFINE_METHOD2(void,                unregister_logger,        (cp_context_t *p1, cp_logger_func_t p2))
74   DEFINE_METHOD2(cp_status_t,         scan_plugins,             (cp_context_t *p1, int p2))
75   DEFINE_METHOD3(cp_plugin_info_t*,   get_plugin_info,          (cp_context_t *p1, const char *p2, cp_status_t *p3))
76   DEFINE_METHOD3(cp_plugin_info_t**,  get_plugins_info,         (cp_context_t *p1, cp_status_t *p2, int *p3))
77   DEFINE_METHOD4(cp_extension_t**,    get_extensions_info,      (cp_context_t *p1, const char *p2, cp_status_t *p3, int *p4))
78   DEFINE_METHOD2(void,                release_info,             (cp_context_t *p1, void *p2))
79
80   DEFINE_METHOD2(cp_cfg_element_t*,   lookup_cfg_element,       (cp_cfg_element_t *p1, const char *p2))
81   DEFINE_METHOD2(char*,               lookup_cfg_value,         (cp_cfg_element_t *p1, const char *p2))
82
83   DEFINE_METHOD3(cp_status_t,         define_symbol,            (cp_context_t *p1, const char *p2, void *p3))
84   DEFINE_METHOD4(void*,               resolve_symbol,           (cp_context_t *p1, const char *p2, const char *p3, cp_status_t *p4))
85   DEFINE_METHOD2(void,                release_symbol,           (cp_context_t *p1, const void *p2))
86   DEFINE_METHOD3(cp_plugin_info_t*,   load_plugin_descriptor,   (cp_context_t *p1, const char *p2, cp_status_t *p3))
87   DEFINE_METHOD4(cp_plugin_info_t*,   load_plugin_descriptor_from_memory, (cp_context_t *p1, const char *p2, unsigned int p3, cp_status_t *p4))
88   DEFINE_METHOD2(cp_status_t,         uninstall_plugin,         (cp_context_t *p1, const char *p2))
89
90   BEGIN_METHOD_RESOLVE()
91     RESOLVE_METHOD_RENAME(cp_get_version, get_version)
92     RESOLVE_METHOD_RENAME(cp_set_fatal_error_handler, set_fatal_error_handler)
93     RESOLVE_METHOD_RENAME(cp_init, init)
94     RESOLVE_METHOD_RENAME(cp_destroy, destroy)
95     RESOLVE_METHOD_RENAME(cp_create_context, create_context)
96     RESOLVE_METHOD_RENAME(cp_destroy_context, destroy_context)
97     RESOLVE_METHOD_RENAME(cp_register_pcollection, register_pcollection)
98     RESOLVE_METHOD_RENAME(cp_unregister_pcollection, unregister_pcollection)
99     RESOLVE_METHOD_RENAME(cp_unregister_pcollections, unregister_pcollections)
100     RESOLVE_METHOD_RENAME(cp_register_logger, register_logger)
101     RESOLVE_METHOD_RENAME(cp_unregister_logger, unregister_logger)
102     RESOLVE_METHOD_RENAME(cp_scan_plugins, scan_plugins)
103     RESOLVE_METHOD_RENAME(cp_get_plugin_info, get_plugin_info)
104     RESOLVE_METHOD_RENAME(cp_get_plugins_info, get_plugins_info)
105     RESOLVE_METHOD_RENAME(cp_get_extensions_info, get_extensions_info)
106     RESOLVE_METHOD_RENAME(cp_release_info, release_info)
107     RESOLVE_METHOD_RENAME(cp_lookup_cfg_element, lookup_cfg_element)
108     RESOLVE_METHOD_RENAME(cp_lookup_cfg_value, lookup_cfg_value)
109     RESOLVE_METHOD_RENAME(cp_define_symbol, define_symbol)
110     RESOLVE_METHOD_RENAME(cp_resolve_symbol, resolve_symbol)
111     RESOLVE_METHOD_RENAME(cp_release_symbol, release_symbol)
112     RESOLVE_METHOD_RENAME(cp_load_plugin_descriptor, load_plugin_descriptor)
113     RESOLVE_METHOD_RENAME(cp_load_plugin_descriptor_from_memory, load_plugin_descriptor_from_memory)
114     RESOLVE_METHOD_RENAME(cp_uninstall_plugin, uninstall_plugin)
115   END_METHOD_RESOLVE()
116 };