本文整理汇总了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());
}
示例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);
}