Polygon Crucher SDK - Documentation
Documentation
Loading...
Searching...
No Matches
Plugins.h
1#ifndef __DEITOOLSPLUGIN_H__
2#define __DEITOOLSPLUGIN_H__
3
4#ifndef MOOTOOLS_NO_PLUGINS
5#include "FileInfo.h"
6#endif
7
8BEGIN_MOOTOOLS_NAMESPACE
9
10#ifndef MOOTOOLS_NO_PLUGINS
11
12#ifdef __WINDOWS__
13#define xPluginHandle HINSTANCE
14#elif defined(__LINUX__) || defined(__APPLE__)
15#define xPluginHandle void *
16#endif
17
18class CFileIo;
19typedef struct IOGetParserInfo
20{
21 // Input
22 CFileIo *io;
23 unsigned int fileclass;
24
25 // Output
26 CFileParser *parser;
28
29typedef struct PluginInfo
30{
31 xPluginHandle pluginHandle;
32 void *procAdress;
33
34 PluginInfo()
35 {
36 pluginHandle = NULL;
37 procAdress = NULL;
38 }
39
40 PluginInfo(xPluginHandle hInstance, void *procAdress)
41 {
42 this->pluginHandle = hInstance;
43 this->procAdress = procAdress;
44 }
45} PluginInfo;
46
47#define MAKE_MOOTOOLS_VERSION_ID(a, b) ((unsigned int)(((unsigned short)a << 16)|((unsigned short)b)))
48#define MOOTOOLS_PLUGIN_VERSION MAKE_MOOTOOLS_VERSION_ID(5, 0)
49#define MOOTOOLS_PLUGIN_VERSION_LOW(a) ((unsigned short)a & 0xFFFF)
50#define MOOTOOLS_PLUGIN_VERSION_HIGH(a) ((unsigned short)(a >> 16))
51
52#define IO_BITMAP_PARSER_PLUGIN_PROC_ADRESS "InitBitmapParser"
53#define IO_3D_PARSER_PLUGIN_PROC_ADRESS "Init3DParser"
54
55// Common function and structure for plugin
56// IO plugins
57class CFileIo;
58typedef struct IOInitPluginInfo
59{
60 // Output
62} IOInitPluginInfo;
63
64DLL_TOOLSFUNCTION void RegisterIOPlugins(unsigned int kindOfFile, const CXString& dllPath = CXString());
65DLL_TOOLSFUNCTION void FreeIOPlugins(unsigned int kindOfFile);
66void RegisterIOPlugins(LPCSTR procAdress, unsigned int kindOfFile, const CXString& dllPath = CXString());
67void FreeIOPlugins(LPCSTR procAdress);
68
69// Plugins
70DLL_TOOLSFUNCTION int FilterPlugins(unsigned int fileclass); // Only allow the given class. Call it repeateadly to add several classes
71DLL_TOOLSFUNCTION void SetPluginsDirectory(const CXString& path, bool addPluginDir); // Return the plugin directory. By default this is the application path. It automatically adds /plugins to the specified dir if needed
72DLL_TOOLSFUNCTION CXString GetPluginsDirectory();
73DLL_TOOLSFUNCTION bool LoadPlugin(const CXString& path, LPCSTR initProcName, PluginInfo& info);
74DLL_TOOLSFUNCTION void FreePlugin(xPluginHandle pluginHandle, LPCSTR initProcName, bool dontLoadAgain);
75DLL_TOOLSFUNCTION void FreePlugins(LPCSTR initProcName);
76
77// These could be used to declare plugins
78#ifdef __WINDOWS__
79#define PLUGINEXPORT_FUNCTION extern "C" __declspec(dllexport)
80#endif
81
82#if defined(__APPLE__) || defined(__LINUX__)
83#define PLUGINEXPORT_FUNCTION extern "C" __attribute__((visibility("default")))
84#endif
85
86// Common library version functions
87PLUGINEXPORT_FUNCTION unsigned int MootoolsGetPluginVersion();
88
89// Specific library entry point
90PLUGINEXPORT_FUNCTION bool InitBitmapParser(IoPluginMode mode, void *data);
91PLUGINEXPORT_FUNCTION bool Init3DParser(IoPluginMode mode, void *data);
92
93#endif // MOOTOOLS_NO_PLUGINS
94
95END_MOOTOOLS_NAMESPACE
96
97#endif //__DEITOOLSPLUGIN_H__
Contains many convenient functions for handling files, paths and give a way to add some custom format...
CXTString< TCHAR > CXString
CXString depend on the target OS. Could be CXStringW (Windows) or CXStringA (Linux / Macos)
Definition XString.h:118
The class defines an x, y, z 3D point which can use int, float or double.
Definition 3DPoint.h:27
Definition IoCommon.h:150
Definition IoCommon.h:130
Definition Plugins.h:20