当前位置: 首页>>代码示例>>C++>>正文


C++ Plugin::format_proc方法代码示例

本文整理汇总了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;
}
开发者ID:derkreature,项目名称:FreeImage,代码行数:54,代码来源:Plugin.cpp

示例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;
}
开发者ID:benbradford,项目名称:kgl_root,代码行数:49,代码来源:Plugin.cpp


注:本文中的Plugin::format_proc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。