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


C++ IAAFMob::CountComments方法代码示例

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


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

示例1: CreateAAFFile


//.........这里部分代码省略.........
		checkResult(pMob->AppendKLVData(pKLVData));		  
		checkExpression(pMob->AppendKLVData(pKLVData) == AAFRESULT_OBJECT_ALREADY_ATTACHED,
		  														AAFRESULT_TEST_FAILED);		  
		  												
		// RemoveKLVData - remove object #2
		checkExpression(pMob->RemoveKLVData(NULL) == AAFRESULT_NULL_PARAM,
		  												AAFRESULT_TEST_FAILED);		  
 		checkResult(pMob->CountKLVData(&numFound));
		checkExpression(numFound == 2, AAFRESULT_TEST_FAILED);
 		checkResult(pMob->RemoveKLVData(pKLVData));
 		checkResult(pMob->CountKLVData(&numFound));
		checkExpression(numFound == 1, AAFRESULT_TEST_FAILED);
		pKLVData->Release();
		pKLVData = NULL;
 		  
		// Try removing an object that is not attached
 		checkResult(defs.cdKLVData()->
					  CreateInstance(IID_IAAFKLVData, 
									 (IUnknown **)&pKLVData));
		checkResult(pKLVData->Initialize(TEST_KLV, sizeof(KLVsmiley), 
		  													(unsigned char *)KLVsmiley));
		checkExpression(pMob->RemoveKLVData(pKLVData) == AAFRESULT_OBJECT_NOT_ATTACHED, 
		  												AAFRESULT_TEST_FAILED);
		// Attach it to replace the one removed												
		checkResult(pMob->AppendKLVData(pKLVData));

		pKLVData->Release();
		pKLVData = NULL;

		// Comments
		checkExpression(pMob->GetComments(&enumTaggedVal) == AAFRESULT_PROP_NOT_PRESENT,
													AAFRESULT_TEST_FAILED);
		// Check CountComments()
		checkExpression(pMob->CountComments(NULL) == AAFRESULT_NULL_PARAM,
															AAFRESULT_TEST_FAILED);
		numComments = 1;
		checkResult(pMob->CountComments(&numComments));
		checkExpression(numComments == 0, AAFRESULT_TEST_FAILED);
		
		// Check AppendComments()
		checkExpression(pMob->AppendComment(NULL, pComment[0]) == AAFRESULT_NULL_PARAM,
																	AAFRESULT_TEST_FAILED);
		checkExpression(pMob->AppendComment(const_cast<aafWChar*>(pCategory[0]), NULL) == AAFRESULT_NULL_PARAM,
																	AAFRESULT_TEST_FAILED);
		for (i = 0; i < 5; ++i)
		{
		checkResult(pMob->AppendComment(const_cast<aafWChar*>(pCategory[i]), pComment[i]));
		}

		checkResult(pMob->CountComments(&numComments));
		checkExpression(numComments == 5, AAFRESULT_TEST_FAILED);

		// Check GetComments()
		checkExpression(pMob->GetComments(NULL) == AAFRESULT_NULL_PARAM,
													AAFRESULT_TEST_FAILED);
		checkResult(pMob->GetComments(&enumTaggedVal));
		for (i = 0; i < 5; ++i)
		{						
			checkResult(enumTaggedVal->NextOne(&taggedVal));
			
			checkResult(taggedVal->GetNameBufLen(&bufLen));
			checkResult(taggedVal->GetName(name, bufLen));
			checkExpression(wcscmp(name, pCategory[i]) == 0, AAFRESULT_TEST_FAILED);
			
			checkResult(taggedVal->GetValueBufLen(&bufLen));
			checkResult(taggedVal->GetValue(bufLen, (aafDataBuffer_t)value, &bytesRead));
开发者ID:mcanthony,项目名称:aaf,代码行数:67,代码来源:CAAFMobTest.cpp

示例2: ReadAAFFile

static HRESULT ReadAAFFile(aafWChar * pFileName)
{
	IAAFFile *					pFile = NULL;
	bool bFileOpen = false;
	IAAFHeader *				pHeader = NULL;
	IEnumAAFMobs *mobIter = NULL;
	IAAFMob			*aMob = NULL;
	IEnumAAFMobSlots	*slotIter = NULL;
	IEnumAAFTaggedValues* pCommentIterator = NULL;
	IAAFTaggedValue*		pComment = NULL;

	IAAFMobSlot		*slot = NULL;
	aafNumSlots_t	numMobs, n, slt;
	aafUInt32		numComments, bytesRead, com;
	HRESULT						hr = S_OK;
	aafWChar		tag[64];
	aafWChar		Value[64];
	aafSearchCrit_t	criteria;

	try
	{
		// Open the file
		checkResult(AAFFileOpenExistingRead(pFileName, 0, &pFile));
		bFileOpen = true;

		// We can't really do anthing in AAF without the header.
  		checkResult(pFile->GetHeader(&pHeader));

		criteria.searchTag = kAAFByMobKind;
		criteria.tags.mobKind = kAAFCompMob;


		checkResult(pHeader->CountMobs(kAAFCompMob, &numMobs));
		checkExpression(1 == numMobs, AAFRESULT_TEST_FAILED);


		checkResult(pHeader->GetMobs (&criteria, &mobIter));

		for(n = 0; n < numMobs; n++)
		{
			aafWChar		name[500], slotName[500];
			aafNumSlots_t	numSlots;
			aafMobID_t		mobID;
			aafSlotID_t		trackID;

			checkResult(mobIter->NextOne (&aMob));
			checkResult(aMob->GetName (name, sizeof(name)));
			checkResult(aMob->GetMobID (&mobID));

			// Check for comments
			checkResult(aMob->CountComments(&numComments));
			checkExpression(1 == numComments, AAFRESULT_TEST_FAILED);
			checkResult(aMob->GetComments(&pCommentIterator));
			for(com = 0; com < numComments; com++)
			{
				checkResult(pCommentIterator->NextOne(&pComment));
				checkResult(pComment->GetName(tag, sizeof(tag)));
				checkResult(pComment->GetValue( sizeof(Value), (unsigned char *)Value, &bytesRead));
				checkExpression(wcscmp(tag, TagNames)== 0, AAFRESULT_TEST_FAILED);
				checkExpression(wcscmp(Value, AltComment)== 0, AAFRESULT_TEST_FAILED);
				pComment->Release();
			}
			pCommentIterator->Release();
			
			checkResult(aMob->CountSlots (&numSlots));
			checkExpression(5 == numSlots, AAFRESULT_TEST_FAILED);

			checkResult(aMob->GetSlots(&slotIter));

			for(slt = 0; slt < numSlots; slt++)
			{
				checkResult(slotIter->NextOne (&slot));
				checkResult(slot->GetName (slotName, sizeof(slotName)));
				checkResult(slot->GetSlotID(&trackID));
				checkExpression (wcscmp(slotName, slotNames[slt]) == 0, AAFRESULT_TEST_FAILED);

				slot->Release();
				slot = NULL;
			}

			aMob->Release();
			aMob = NULL;
		}
	}
	catch (HRESULT& rResult)
	{
    hr = rResult;
	}

	// Cleanup object references
  if (slot)
    slot->Release();

  if (slotIter)
    slotIter->Release();

  if (aMob)
    aMob->Release();

  if (mobIter)
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:CAAFTaggedValueTest.cpp


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