本文整理汇总了C++中Plugin::format_proc方法的典型用法代码示例。如果您正苦于以下问题:C++ Plugin::format_proc方法的具体用法?C++ Plugin::format_proc怎么用?C++ Plugin::format_proc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugin
的用法示例。
在下文中一共展示了Plugin::format_proc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: new
FREE_IMAGE_FORMAT
PluginList::AddNode(FI_InitProc init_proc, void *instance, const char *format, const char *description, const char *extension, const char *regexpr) {
if (init_proc != NULL) {
PluginNode *node = new(std::nothrow) PluginNode;
Plugin *plugin = new(std::nothrow) Plugin;
if(!node || !plugin) {
if(node) delete node;
if(plugin) delete plugin;
FreeImage_OutputMessageProc(FIF_UNKNOWN, FI_MSG_ERROR_MEMORY);
return FIF_UNKNOWN;
}
memset(plugin, 0, sizeof(Plugin));
// fill-in the plugin structure
// note we have memset to 0, so all unset pointers should be NULL)
init_proc(plugin, (int)m_plugin_map.size());
// get the format string (two possible ways)
const char *the_format = NULL;
if (format != NULL) {
the_format = format;
} else if (plugin->format_proc != NULL) {
the_format = plugin->format_proc();
}
// add the node if it wasn't there already
if (the_format != NULL) {
node->m_id = (int)m_plugin_map.size();
node->m_instance = instance;
node->m_plugin = plugin;
node->m_format = format;
node->m_description = description;
node->m_extension = extension;
node->m_regexpr = regexpr;
node->m_enabled = TRUE;
m_plugin_map[(const int)m_plugin_map.size()] = node;
return (FREE_IMAGE_FORMAT)node->m_id;
}
// something went wrong while allocating the plugin... cleanup
delete plugin;
delete node;
}
return FIF_UNKNOWN;
}
示例2: if
FREE_IMAGE_FORMAT
PluginList::AddNode(FI_InitProc init_proc, void *instance, const char *format, const char *description, const char *extension, const char *regexpr) {
if (init_proc != NULL) {
PluginNode *node = new PluginNode;
Plugin *plugin = new Plugin;
memset(plugin, 0, sizeof(Plugin));
// fill-in the plugin structure
init_proc(plugin, m_plugin_map.size());
// get the format string (two possible ways)
const char *the_format = NULL;
if (format != NULL)
the_format = format;
else if (plugin->format_proc != NULL)
the_format = plugin->format_proc();
// add the node if it wasn't there already
if (the_format != NULL) {
if (FindNodeFromFormat(the_format) == NULL) {
node->m_id = m_plugin_map.size();
node->m_instance = instance;
node->m_plugin = plugin;
node->m_format = format;
node->m_description = description;
node->m_extension = extension;
node->m_regexpr = regexpr;
node->m_next = NULL;
node->m_enabled = TRUE;
m_plugin_map[m_plugin_map.size()] = node;
return (FREE_IMAGE_FORMAT)node->m_id;
}
}
// something went wrong while allocating the plugin... cleanup
delete plugin;
delete node;
}
return FIF_UNKNOWN;
}