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


C++ Filter::IS_KIND_OF方法代码示例

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


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

示例1: LoadFile

BOOL OpMenuLoad::LoadFile(CCLexFile* pFileToLoad, UINT32 nPrefFilter)
{
	// Make sure we have a valid file to load.
/*	TRACEUSER( "JustinF", _T("In OpMenuLoad::LoadFile(%p, %u)\n"),
				(LPVOID) pFileToLoad, nPrefFilter);
*/	ERROR3IF(!pFileToLoad, "Null CCLexFile* in OpMenuLoad::LoadFile");
	
	// Find out the position of the filter selected by the user in the open dialog
	INT32 SelectedPos = 0;

#if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
	SelectedPos = BaseFileDialog::SelectedFilter;
#endif

	// Go get the first filter in the list
	Filter* pFilter = Filter::GetFirst();

	// Do we know which filter was used? (we know nothing about things in the recent file
	// list).  If we don't, then use the preferred one, by default the generic filter.
	if (nPrefFilter != FILTERID_USERCHOICE || SelectedPos == 0)
	{
		// We know nothing. We will have to go and have a look at all the possibles
		// We will find the Filter Family and ask it to try and load the file.
		UINT32 nID = (nPrefFilter != FILTERID_USERCHOICE) ? nPrefFilter : FILTERID_GENERIC;
		while (pFilter != NULL && pFilter->FilterID != nID)
		{
			// Try the next filter
			pFilter = Filter::GetNext(pFilter);
		}
	}
	else
	{
		// We know which type of filter the user had selected in the file dialog
		// Find the filter that the user chose.
		while (pFilter != NULL)
		{
			// This is the filter?
			if (pFilter->GetFlags().CanImport &&
				pFilter->pOILFilter->Position == SelectedPos)
					break;

			// Try the next filter
			pFilter = Filter::GetNext(pFilter);
		}
	}
	
	// Check that the Filter existed
	if (pFilter == NULL)
	{
		// It did not...
		InformError(_R(IDT_CANT_FIND_FILTER));
		return FALSE;
	}

	// Get pointer to current doc 'cos we'll need it several times...
	Document* pCurDoc = Document::GetCurrent();

	// If this is not a filter family, check for compatibility before asking
	// filter to load the file.
	// This means the user has chosen an explicit filter to handle the import
	PathName Path = pFileToLoad->GetPathName();
	String_256 FilePath = Path.GetPath();
	// FilePath will be null if a pathname is not valid
	if (!pFilter->IS_KIND_OF(FilterFamily) && !FilePath.IsEmpty())
	{
		UINT32		Size = 1024;
		size_t		FileSize;
		ADDR		FilterBuf = pFilter->LoadInitialSegment(Path, &Size, &FileSize);

		// If there has been a problem in the load initial segment then fail now.
		if (FilterBuf == NULL)
		{
			// Tell the user about the problem and get out now while the goings good 
			InformError();
			return FALSE;
		}

		// Inform any filters that we are about to do a HowCompatible call.
		// This would allow a set of filters which have common functionality hidden in a
		// filter that cannot import and cannot export handle this call and hence set
		// itself up. This would allow it to maybe cache a result which should only be
		// checked by the first filter in the group. 
		pFilter->PreHowCompatible();
		
		// Change this to be less than 8 as the filters like the Accusoft forms return
		// 8 and 9 to make sure that they are last in the chain.
		if (pFilter->HowCompatible(Path, FilterBuf, Size, UINT32(FileSize)) < 8)
		{
			// Not 100% happy with this file - ask for confirmation.
			ErrorInfo Question;
			Question.ErrorMsg = _R(IDW_OPENQUERY_NOTSURE);
			Question.Button[0] = _R(IDB_OPENQUERY_OPEN);
			Question.Button[1] = _R(IDB_OPENQUERY_DONTOPEN);

			if ((ResourceID)AskQuestion(&Question) != _R(IDB_OPENQUERY_OPEN))
			{
				// User asked for this to be cancelled.
				TRACEUSER( "Tim", _T("Filter compatibility was less than 10\n"));

				// Close the file, report the abort and finish.
//.........这里部分代码省略.........
开发者ID:vata,项目名称:xarino,代码行数:101,代码来源:nativeop.cpp

示例2: LoadThumbnailIntoSlot


//.........这里部分代码省略.........
#endif //WEBSTER
			}
			else if(IsPCDTypeFile)
			{
#ifndef WEBSTER //WEBSTER-Martin-21/01/97
				if ( AccusoftFilters::GetVersionNumber() > 0)
				{
					TRACEUSER( "Martin", _T("Accusoft read PCD preview\n"));
					// Use the tiny preview... (we're a friend of AccusoftFilters by the way)
					AccusoftFilters::ImagePageToRead = 2;
					ReadOK = AccusoftFilters::ReadFromFile( &File, &pCWxBitmap->BMInfo, &pCWxBitmap->BMBytes, TRUE, NULL, NULL, TRUE );
				}
				else
				{
					TRACEUSER( "Martin", _T("Accusoft filter not loaded\n"));
					ReadOK = FALSE;
				}
#endif //WEBSTER
			}
			else // new native file
			{
				// First, check that we have a CX2/XaraX format file, and
				// try to extract its preview bitmap at the same time.
				BOOL IsNewFormat = FALSE;
				UINT32 FilterId = FILTERID_NONE;
				if (BaseCamelotFilter::SkipToPreviewBitmap(&File, &IsNewFormat, &FilterId))
				{
					// Get the preview!
					if (FilterId != FILTERID_NONE)
					{
						Filter* pFilter = Filter::FindFilterFromID(FilterId);
						if (pFilter != NULL)
						{
							ERROR3IF( !pFilter->IS_KIND_OF(BaseBitmapFilter), "Preview filter is not a BaseBitmapFilter\n" );
							ReadOK = ((BaseBitmapFilter *)pFilter)->ReadFromFile( pCWxBitmap, NULL, &File, FALSE );
						}
					}
					
					// Couldn't find a preview bitmap, so we'll make a note to
					// check for an external preview file instead.
					else
					{
						UseActualFile	= FALSE;
						Found			= FALSE;
						File.close();

						delete pCWxBitmap;
						pCWxBitmap = NULL;
					}
				}

				// SkipToPreviewBitmap failed, so we'll assume that it's an old-format file.
				// In that case, we must try to load in its TIFF preview.
				else
				{
					if (AccusoftFilters::GetVersionNumber() > 0)
						ReadOK = AccusoftFilters::ReadFromFile( &File, &pCWxBitmap->BMInfo, &pCWxBitmap->BMBytes, TRUE );
					else
						ReadOK = FALSE;
				}
			}
		}
		else
		{
			TRACEUSER( "Martin", _T("Failed to find original file %s\n"), (const TCHAR *)ActualFile->GetFileName(TRUE));
		 	Error::ClearError();
开发者ID:vata,项目名称:xarino,代码行数:67,代码来源:thumb.cpp


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