00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
#ifndef UPLUGIN_HPP
00029
#define UPLUGIN_HPP
00030
00031
#include "uobject.hpp"
00032
#include "font/ufontinfo.hpp"
00033
00034
namespace ufo {
00035
00036
class UFontRenderer;
00037
class ULookAndFeel;
00038
class UVideoDriver;
00039
class USharedLib;
00040
00046 class UFO_EXPORT UPluginBase :
public UObject {
00047 UFO_DECLARE_DYNAMIC_CLASS(UPluginBase)
00048 };
00049
00050
typedef UPluginBase* (*plugin_create_t)(
void);
00051
typedef void (*plugin_destroy_t)(UPluginBase*);
00052
00053
#define UFO_PLUGIN(category, feature, plugin) \
00054
extern "C" { \
00055
const char* ufo_plugin_category = category; \
00056
const char* ufo_plugin_feature = feature; \
00057
UPluginBase* ufo_plugin_create() \
00058
{ return static_cast<PluginBase*>(new plugin()); } \
00059
void ufo_plugin_destroy(PluginBase* c) \
00060
{ delete static_cast<plugin*>(c); } \
00061
}
00062
00069 struct UFO_EXPORT UPluginInfo {
00073 USharedLib * lib;
00075 std::string category;
00077 std::string feature;
00078 plugin_create_t create;
00079 plugin_destroy_t destroy;
00080 };
00081
00082
00083
inline UFO_EXPORT
bool operator==(
const UPluginInfo & p1,
const UPluginInfo & p2) {
00084
return (
00085 p1.
lib == p2.
lib &&
00086 p1.
category == p2.
category &&
00087 p1.
feature == p2.
feature &&
00088 p1.
create == p2.
create &&
00089 p1.
destroy == p2.
destroy
00090 );
00091 }
00092
00100 class UFO_EXPORT UFontPlugin :
public UPluginBase {
00101 UFO_DECLARE_DYNAMIC_CLASS(UFontPlugin)
00102
public:
00106
virtual UFontRenderer * createFontRenderer(
const UFontInfo & fontInfo) = 0;
00110
virtual UFontInfo queryFont(
const UFontInfo & fontInfo) = 0;
00111
virtual std::vector<UFontInfo> listFonts(
const UFontInfo & fontInfo) = 0;
00112
virtual std::vector<UFontInfo> listFonts() = 0;
00113 };
00114
00121 class UFO_EXPORT ULAFPlugin :
public UPluginBase {
00122 UFO_DECLARE_DYNAMIC_CLASS(ULAFPlugin)
00123
public:
00124
virtual ULookAndFeel * createLookAndFeel() = 0;
00125 };
00126
00134 class UFO_EXPORT UImageIOPlugin :
public UPluginBase {
00135 UFO_DECLARE_DYNAMIC_CLASS(UImageIOPlugin)
00136
public:
00137 };
00138
00144 class UFO_EXPORT UVideoPlugin :
public UPluginBase {
00145 UFO_DECLARE_DYNAMIC_CLASS(UVideoPlugin)
00146
public:
00147
virtual bool isAvailable() = 0;
00148
virtual UVideoDriver * createVideoDriver() = 0;
00149 };
00150
00151 }
00152
00153
#endif // UPLUGIN_HPP