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


C++ LockManager::IsDocIDLocked方法代码示例

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


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

示例1: ActualTestImportDocument

void TestOnMappedNetworkDrives::ActualTestImportDocument()
{
	DocProviderWorker	objWorker;
	WSDocNonCom			wsDoc;
	LockManager			lockMgr;

	CStdString sMappedDriveLetter = m_NetDriveHelper.GetMapNetworkDriveLetter();
	assertMessage(!sMappedDriveLetter.IsEmpty(), _T("Cannot map network drive - used to just skip test"));
	CStdString sOrigFile = sMappedDriveLetter + _T("\\Original.doc");

	DocumentID docImportID(DocumentID::GenerateIdFromFilePath(sOrigFile));
	CStdString csLocalFile = docImportID.CreateLocalFile();
	objWorker.PopulateDocumentProperties(docImportID, wsDoc, false);
	CStdString sOldDocID = wsDoc.GetDocId();
	HRESULT hrImport = objWorker.ImportDocument(wsDoc, false);

	assertMessage(SUCCEEDED(hrImport),_T("Failure code returned from ImportDocument()"));

	if(sOldDocID.CompareNoCase( CStdString(wsDoc.GetDocId()))==0)
	{
		assertMessage(false,_T("The in and out DocID's are the same after import"));
	}


	// check lock=false
	CStdString sLockedBy;
	if(lockMgr.IsDocIDLocked(wsDoc.GetDocId(), sLockedBy) )
	{
		assertMessage(false, _T("Imported file is locked when it was requested not to be"));
	}

	if(docImportID.GetDescription() != wsDoc.GetDescription())
	{
		assertMessage(false, _T("The document Description does not match the original file used for the import."));
	}
	
	assertTest((wsDoc.GetFlags() & DOCUMENT_LOCKED_BY_US)==0);

	LFSDMSHelper dmsHelp;

	DocumentID docID(wsDoc.GetDocId());
	CStdString	sLocalName(docID.GetWorkingFile());
	int iFileNameStartsAt = sLocalName.ReverseFind('\\');
	if ((iFileNameStartsAt != CStdString::npos) && (dmsHelp.DoesFileExist(sLocalName)))
	{
		sLocalName.resize(iFileNameStartsAt);
		assertTest(dmsHelp.DeleteDirectoryAndContents(sLocalName));
	}
	::DeleteFile(csLocalFile.c_str());
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:50,代码来源:TestOnMappedNetworkDrives.cpp

示例2: TestUnlocksFileOnClose

void TestCloseDocument::TestUnlocksFileOnClose()
{
	DocProviderWorker	objWorker;
	WSDocNonCom			wsDoc;
	DocumentID			docTarget(DocumentID::GenerateIdFromFilePath(sTestOriginalFileName));
	
	wsDoc.SetDescription(docTarget.GetDescription());
	wsDoc.SetLocalFile(docTarget.GetWorkingFile());
	assertTest(objWorker.ImportDocument(wsDoc, true) == S_OK);
	m_wsImportedDoc = wsDoc;
	assertTest(objWorker.CloseDocument(wsDoc,0) == S_OK);

	LockManager lckMngr;
	CStdString sLockedBy;
	assertTest(lckMngr.IsDocIDLocked(wsDoc.GetDocId(),sLockedBy) == false);
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:16,代码来源:TestCloseDocument.cpp


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