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


C++ IAAFHeader::CountIdentifications方法代码示例

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


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

示例1: ReadAAFFile

static HRESULT ReadAAFFile(aafWChar * pFileName)
{
	IAAFFile *					pFile = NULL;
	bool						bFileOpen = false;
	IAAFHeader *				pHeader = NULL;
	IAAFIdentification			*pIdent = NULL;
	HRESULT						hr = S_OK;
	aafUInt32					readNumIdents, readNameLen;
	aafWChar					readBuf[256];
	aafUID_t					readUID;
	aafProductVersion_t			readVersion;

	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));
		checkResult(pHeader->CountIdentifications(&readNumIdents));
		checkExpression(1 == readNumIdents, AAFRESULT_TEST_FAILED);
		checkResult(pHeader->GetLastIdentification (&pIdent));
		/***/
		checkResult(pIdent->GetCompanyNameBufLen (&readNameLen));
		checkExpression(readNameLen < 256, AAFRESULT_TEST_FAILED);
		checkResult(pIdent->GetCompanyName (readBuf, readNameLen));
		checkExpression(wcscmp(COMPANY_NAME, readBuf) == 0, AAFRESULT_TEST_FAILED);
		/***/
		checkResult(pIdent->GetProductNameBufLen (&readNameLen));
		checkExpression(readNameLen < 256, AAFRESULT_TEST_FAILED);
		checkResult(pIdent->GetProductName (readBuf, readNameLen));
		checkExpression(wcscmp(PRODUCT_NAME, readBuf) == 0, AAFRESULT_TEST_FAILED);
		/***/
		checkResult(pIdent->GetProductVersionStringBufLen (&readNameLen));
		checkExpression(readNameLen < 256, AAFRESULT_TEST_FAILED);
		checkResult(pIdent->GetProductVersionString (readBuf, readNameLen));
		checkExpression(wcscmp(TEST_VERSION, readBuf) == 0, AAFRESULT_TEST_FAILED);
		/***/
		checkResult(pIdent->GetProductID(&readUID));
		checkExpression(memcmp(&readUID, &UnitTestProductID, sizeof(UnitTestProductID)) == 0, AAFRESULT_TEST_FAILED);
		checkResult(pIdent->GetProductVersion(&readVersion));
		/***/
		checkExpression(readVersion.major == testVersion.major, AAFRESULT_TEST_FAILED);
		checkExpression(readVersion.minor == testVersion.minor, AAFRESULT_TEST_FAILED);
		checkExpression(readVersion.tertiary == testVersion.tertiary, AAFRESULT_TEST_FAILED);
		checkExpression(readVersion.patchLevel == testVersion.patchLevel, AAFRESULT_TEST_FAILED);
		checkExpression(readVersion.type == testVersion.type, AAFRESULT_TEST_FAILED);		
		checkResult(pFile->Close());
		bFileOpen = false;
		
	}
	catch (HRESULT& rResult)
	{
		hr = rResult;
	}
	
	
	// Cleanup and return
		
	if (pHeader)
		pHeader->Release();
	
	if (pIdent)
		pIdent->Release();
	
	if (pFile)
	{	// Close file
		if (bFileOpen)
			pFile->Close();
		pFile->Release();
	}
	
	return hr;
}
开发者ID:mcanthony,项目名称:aaf,代码行数:75,代码来源:CAAFIdentificationTest.cpp

示例2: CreateAAFFile

static HRESULT CreateAAFFile(
    aafWChar * pFileName,
    aafUID_constref fileKind,
    testRawStorageType_t rawStorageType)
{
	IAAFFile *					pFile = NULL;
	bool 						bFileOpen = false;
	IAAFHeader *				pHeader = NULL;
	IAAFDictionary				*pDictionary = NULL;
	IAAFIdentification			*pIdent = NULL;
	IAAFIdentification			*pTestIdent = NULL;
	aafUInt32					readNumIdents;
	char 						testName[35];
	aafCharacter 				*myBuffer;
	aafUInt32 					bufSize = 0;
	aafUInt32 					bufSize2 = 0;

	aafProductIdentification_t	ProductInfo;
	memset(&ProductInfo, 0, sizeof(ProductInfo));
	ProductInfo.companyName = const_cast<aafWChar*>(COMPANY_NAME);
	ProductInfo.productName = const_cast<aafWChar*>(PRODUCT_NAME);
	ProductInfo.productVersionString = const_cast<aafWChar*>(TEST_VERSION);
	ProductInfo.productID = UnitTestProductID;
	ProductInfo.productVersion = &testVersion;
	hr = S_OK;

	try 
	{
		// Remove the previous test file if any.
		RemoveTestFile(pFileName);
				
		// Create the file.
		checkResult(CreateTestFile(pFileName, fileKind,
				rawStorageType, ProductInfo, &pFile));
		bFileOpen = true;
		
		// We can't really do anthing in AAF without the header.
		checkResult(pFile->GetHeader(&pHeader));
		
 	    checkResult(pHeader->GetDictionary(&pDictionary));
	    CAAFBuiltinDefs defs (pDictionary);
		
		checkResult(pHeader->CountIdentifications(&readNumIdents));
		checkExpression(1 == readNumIdents, AAFRESULT_TEST_FAILED);
		checkResult(pHeader->GetLastIdentification (&pIdent));

		checkResult(defs.cdIdentification()->
					CreateInstance(IID_IAAFIdentification, 
								   (IUnknown **)&pTestIdent));	

	/* Initialize */
		localhr = AAFRESULT_SUCCESS;
		strcpy(testName, "Initialize()");
		TestMethod(pTestIdent->Initialize(NULL,
									   PRODUCT_NAME,
									   TEST_VERSION,
									   UnitTestProductID), AAFRESULT_NULL_PARAM);
		TestMethod(pTestIdent->Initialize(COMPANY_NAME,
									   NULL,
									   TEST_VERSION,
									   UnitTestProductID), AAFRESULT_NULL_PARAM);
		TestMethod(pTestIdent->Initialize(COMPANY_NAME,
									   PRODUCT_NAME,
									   NULL,
									   UnitTestProductID), AAFRESULT_NULL_PARAM);
		TestMethod(pTestIdent->Initialize(COMPANY_NAME,
									   PRODUCT_NAME,
									   TEST_VERSION,
									   UnitTestProductID), AAFRESULT_SUCCESS);
		TestMethod(pTestIdent->Initialize(COMPANY_NAME,
									   PRODUCT_NAME,
									   TEST_VERSION,
									   UnitTestProductID), AAFRESULT_ALREADY_INITIALIZED);									   
		pTestIdent->Release();
		PrintTestResult(testName);
									   

	/* GetCompanyNameBufLen *****/
		localhr = AAFRESULT_SUCCESS;
		strcpy(testName, "GetCompanyNameBufLen()");
		bufSize = sizeof(COMPANY_NAME);
		bufSize2 = 0;
		TestMethod(pIdent->GetCompanyNameBufLen(NULL), AAFRESULT_NULL_PARAM);
		TestMethod(pIdent->GetCompanyNameBufLen(&bufSize2), AAFRESULT_SUCCESS);
		if (bufSize != bufSize2)
			localhr = AAFRESULT_TEST_FAILED;
		
		PrintTestResult(testName);

	/* GetCompanyName *****/
		localhr = AAFRESULT_SUCCESS;
		strcpy(testName, "GetCompanyName()");
		myBuffer = new aafCharacter [bufSize];
		TestMethod(pIdent->GetCompanyName(NULL, bufSize), AAFRESULT_NULL_PARAM);
		TestMethod(pIdent->GetCompanyName(myBuffer, bufSize-1), AAFRESULT_SMALLBUF);
		TestMethod(pIdent->GetCompanyName(myBuffer, bufSize), AAFRESULT_SUCCESS);
		if (wcscmp(myBuffer, COMPANY_NAME))
			localhr = AAFRESULT_TEST_FAILED;
								
		delete [] myBuffer;
//.........这里部分代码省略.........
开发者ID:mcanthony,项目名称:aaf,代码行数:101,代码来源:CAAFIdentificationTest.cpp


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