/src/FreeImage/Source/Plugin.h

https://bitbucket.org/cabalistic/ogredeps/ · C++ Header · 142 lines · 72 code · 22 blank · 48 comment · 0 complexity · e05eb02a18c171912e9ffad1e1e61d0a MD5 · raw file

  1. // ==========================================================
  2. // FreeImage Plugin Interface
  3. //
  4. // Design and implementation by
  5. // - Floris van den Berg (flvdberg@wxs.nl)
  6. // - Rui Lopes (ruiglopes@yahoo.com)
  7. //
  8. // This file is part of FreeImage 3
  9. //
  10. // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
  11. // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
  12. // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
  13. // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
  14. // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
  15. // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
  16. // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
  17. // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
  18. // THIS DISCLAIMER.
  19. //
  20. // Use at your own risk!
  21. // ==========================================================
  22. #ifdef _MSC_VER
  23. #pragma warning (disable : 4786) // identifier was truncated to 'number' characters
  24. #endif
  25. #ifndef PLUGIN_H
  26. #define PLUGIN_H
  27. #include "FreeImage.h"
  28. #include "Utilities.h"
  29. // ==========================================================
  30. struct Plugin;
  31. // =====================================================================
  32. // Plugin Node
  33. // =====================================================================
  34. FI_STRUCT (PluginNode) {
  35. /** FREE_IMAGE_FORMAT attached to this plugin */
  36. int m_id;
  37. /** Handle to a user plugin DLL (NULL for standard plugins) */
  38. void *m_instance;
  39. /** The actual plugin, holding the function pointers */
  40. Plugin *m_plugin;
  41. /** Enable/Disable switch */
  42. BOOL m_enabled;
  43. /** Unique format string for the plugin */
  44. const char *m_format;
  45. /** Description string for the plugin */
  46. const char *m_description;
  47. /** Comma separated list of file extensions indicating what files this plugin can open */
  48. const char *m_extension;
  49. /** optional regular expression to help software identifying a bitmap type */
  50. const char *m_regexpr;
  51. };
  52. // =====================================================================
  53. // Internal Plugin List
  54. // =====================================================================
  55. class PluginList {
  56. public :
  57. PluginList();
  58. ~PluginList();
  59. FREE_IMAGE_FORMAT AddNode(FI_InitProc proc, void *instance = NULL, const char *format = 0, const char *description = 0, const char *extension = 0, const char *regexpr = 0);
  60. PluginNode *FindNodeFromFormat(const char *format);
  61. PluginNode *FindNodeFromMime(const char *mime);
  62. PluginNode *FindNodeFromFIF(int node_id);
  63. int Size() const;
  64. BOOL IsEmpty() const;
  65. private :
  66. std::map<int, PluginNode *> m_plugin_map;
  67. int m_node_count;
  68. };
  69. // ==========================================================
  70. // Plugin Initialisation Callback
  71. // ==========================================================
  72. void DLL_CALLCONV FreeImage_OutputMessage(int fif, const char *message, ...);
  73. // =====================================================================
  74. // Reimplementation of stricmp (it is not supported on some systems)
  75. // =====================================================================
  76. int FreeImage_stricmp(const char *s1, const char *s2);
  77. // ==========================================================
  78. // Internal functions
  79. // ==========================================================
  80. extern "C" {
  81. BOOL DLL_CALLCONV FreeImage_Validate(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle);
  82. void * DLL_CALLCONV FreeImage_Open(PluginNode *node, FreeImageIO *io, fi_handle handle, BOOL open_for_reading);
  83. void DLL_CALLCONV FreeImage_Close(PluginNode *node, FreeImageIO *io, fi_handle handle, void *data); // plugin.cpp
  84. PluginList * DLL_CALLCONV FreeImage_GetPluginList(); // plugin.cpp
  85. }
  86. // ==========================================================
  87. // Internal plugins
  88. // ==========================================================
  89. void DLL_CALLCONV InitBMP(Plugin *plugin, int format_id);
  90. void DLL_CALLCONV InitCUT(Plugin *plugin, int format_id);
  91. void DLL_CALLCONV InitICO(Plugin *plugin, int format_id);
  92. void DLL_CALLCONV InitIFF(Plugin *plugin, int format_id);
  93. void DLL_CALLCONV InitJPEG(Plugin *plugin, int format_id);
  94. void DLL_CALLCONV InitKOALA(Plugin *plugin, int format_id);
  95. void DLL_CALLCONV InitLBM(Plugin *plugin, int format_id);
  96. void DLL_CALLCONV InitMNG(Plugin *plugin, int format_id);
  97. void DLL_CALLCONV InitPCD(Plugin *plugin, int format_id);
  98. void DLL_CALLCONV InitPCX(Plugin *plugin, int format_id);
  99. void DLL_CALLCONV InitPNG(Plugin *plugin, int format_id);
  100. void DLL_CALLCONV InitPNM(Plugin *plugin, int format_id);
  101. void DLL_CALLCONV InitPSD(Plugin *plugin, int format_id);
  102. void DLL_CALLCONV InitRAS(Plugin *plugin, int format_id);
  103. void DLL_CALLCONV InitTARGA(Plugin *plugin, int format_id);
  104. void DLL_CALLCONV InitTIFF(Plugin *plugin, int format_id);
  105. void DLL_CALLCONV InitWBMP(Plugin *plugin, int format_id);
  106. void DLL_CALLCONV InitXBM(Plugin *plugin, int format_id);
  107. void DLL_CALLCONV InitXPM(Plugin *plugin, int format_id);
  108. void DLL_CALLCONV InitDDS(Plugin *plugin, int format_id);
  109. void DLL_CALLCONV InitGIF(Plugin *plugin, int format_id);
  110. void DLL_CALLCONV InitHDR(Plugin *plugin, int format_id);
  111. void DLL_CALLCONV InitG3(Plugin *plugin, int format_id);
  112. void DLL_CALLCONV InitSGI(Plugin *plugin, int format_id);
  113. void DLL_CALLCONV InitEXR(Plugin *plugin, int format_id);
  114. void DLL_CALLCONV InitJ2K(Plugin *plugin, int format_id);
  115. void DLL_CALLCONV InitJP2(Plugin *plugin, int format_id);
  116. void DLL_CALLCONV InitPFM(Plugin *plugin, int format_id);
  117. void DLL_CALLCONV InitPICT(Plugin *plugin, int format_id);
  118. void DLL_CALLCONV InitRAW(Plugin *plugin, int format_id);
  119. void DLL_CALLCONV InitJNG(Plugin *plugin, int format_id);
  120. #endif //!PLUGIN_H