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


C++ Viewer::GetExtensions方法代码示例

本文整理汇总了C++中Viewer::GetExtensions方法的典型用法代码示例。如果您正苦于以下问题:C++ Viewer::GetExtensions方法的具体用法?C++ Viewer::GetExtensions怎么用?C++ Viewer::GetExtensions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Viewer的用法示例。


在下文中一共展示了Viewer::GetExtensions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GenerateData


//.........这里部分代码省略.........
		Viewer* viewer;
		ChainedHashIterator* viewer_iter;
		g_viewers->CreateIterator(viewer_iter);
		if (viewer_iter != NULL)
		{
			OpAutoPtr<OpHashIterator> viewer_iter_ap(viewer_iter);
			while (viewer_iter && (viewer=g_viewers->GetNextViewer(viewer_iter)) != NULL)
			{
				// Iterate over all plug-ins associated with this MIME type
				unsigned int numpluginviewers = viewer->GetPluginViewerCount();
				for (unsigned int k = 0; k < numpluginviewers; ++ k)
				{
					const PluginViewer *p = viewer->GetPluginViewer(k);
					if (p && p->GetPath() && uni_strcmp(p->GetPath(), plugin_path) == 0)
					{
						// This is us.

						// MIME type
						const uni_char *mime_type = viewer->GetContentTypeString();
						if (mime_type)
						{
							int mimestart = 0;

							RETURN_IF_ERROR(m_url.WriteDocumentData(URL::KNormal, UNI_L(" <tr>\n  <td>")));

							// Split string at "|"s
							for(int i = mimestart = 0; mime_type[i]; ++ i)
							{
								if (mime_type[i] == '|')
								{
									RETURN_IF_ERROR(m_url.WriteDocumentData(URL::KHTMLify, mime_type + mimestart, i - mimestart));
									RETURN_IF_ERROR(m_url.WriteDocumentData(URL::KNormal, UNI_L("<br>\n  ")));

									mimestart = i + 1;
								}
							}

							// Print the remainder of the string
							RETURN_IF_ERROR(m_url.WriteDocumentData(URL::KHTMLify, &mime_type[mimestart]));
							RETURN_IF_ERROR(m_url.WriteDocumentData(URL::KNormal, UNI_L("</td>\n")));
						}

						// Description
						OpString description;
						RETURN_IF_ERROR(p->GetTypeDescription(mime_type, description));
						RETURN_IF_ERROR(m_url.WriteDocumentData(URL::KNormal, UNI_L("  <td>")));
						RETURN_IF_ERROR(m_url.WriteDocumentData(URL::KHTMLify, description));
						RETURN_IF_ERROR(m_url.WriteDocumentData(URL::KNormal, UNI_L("</td>\n")));

						// Extensions
						RETURN_IF_ERROR(m_url.WriteDocumentData(URL::KNormal, UNI_L("  <td>")));

						const uni_char *extensions = viewer->GetExtensions();
						if (extensions)
						{
							int extstart = 0;

							// Split string at "|"s
							for (int i = 0; extensions[i]; ++ i)
							{
								if(extensions[i] == '|')
								{
									RETURN_IF_ERROR(m_url.WriteDocumentData(URL::KHTMLify, extensions + extstart, extstart - i));
									RETURN_IF_ERROR(m_url.WriteDocumentData(URL::KNormal, UNI_L("<br>\n  ")));

									extstart = i + 1;
								}
							}

							// Print the remainder of the string
							RETURN_IF_ERROR(m_url.WriteDocumentData(URL::KHTMLify, &extensions[extstart]));
						}
						RETURN_IF_ERROR(m_url.WriteDocumentData(URL::KNormal, UNI_L("</td>\n </tr>\n")));
					}
				}
			}
		}

		RETURN_IF_ERROR(m_url.WriteDocumentData(URL::KNormal, UNI_L("</table></div>\n")));

		// Finish plug-in block
		RETURN_IF_ERROR(m_url.WriteDocumentData(URL::KNormal, UNI_L("</div>\n</fieldset>\n")));
	}

	if (detecting)
	{
		OpString detecting_str;
		RETURN_IF_ERROR(g_languageManager->GetString(Str::S_PLUGIN_DETECTING, detecting_str));
		RETURN_IF_ERROR(m_url.WriteDocumentDataUniSprintf(UNI_L("<p>%s</p>\n"), detecting_str.CStr()));
	}
	else if (!filtered_viewer_list.GetCount())
	{
		OpString none_found;
		RETURN_IF_ERROR(g_languageManager->GetString(Str::SI_IDSTR_NONE_FOUND, none_found));
		RETURN_IF_ERROR(m_url.WriteDocumentDataUniSprintf(UNI_L("<p>%s</p>\n"), none_found.CStr()));
	}

	// Finish off
	return CloseDocument();
}
开发者ID:prestocore,项目名称:browser,代码行数:101,代码来源:operaplugins.cpp


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