本文整理汇总了C++中Strng::SetIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ Strng::SetIndex方法的具体用法?C++ Strng::SetIndex怎么用?C++ Strng::SetIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Strng
的用法示例。
在下文中一共展示了Strng::SetIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeleteTags
int CGrfDoc::DeleteTags(bool WithPrompts)
{
Strng_List MyTags;
GetTagList(MyTags);
int nTags=MyTags.Length();
int nTagsMultPgs=0;
if (nTags>0)
{
CMap<LPTSTR, LPTSTR, Strng*, Strng*> MyTagMap;
MyTagMap.InitHashTable(FindNextPrimeNumber(MyTags.Length()));
for (Strng *pTag=MyTags.First(); pTag; pTag=MyTags.Next())
{
pTag->SetIndex(0);
MyTagMap.SetAt(pTag->Str(), pTag);
}
for (int iTmpl=iGraphTemplate; iTmpl<=iVisioTemplate; iTmpl++)
{
if (ScdApp()->TemplateExists(iTmpl))
{
POSITION Pos = ScdApp()->Template(iTmpl).GetFirstDocPosition();
while (Pos)
{
CGrfDoc* pOtherDoc = (CGrfDoc*)(ScdApp()->Template(iTmpl).GetNextDoc(Pos));
if (pOtherDoc!=this)
{
Strng *pTag;
Strng_List OtherTags;
int NGrfTags = pOtherDoc->GetTagList(OtherTags);
for (Strng *pOtherTag=OtherTags.First(); pOtherTag; pOtherTag=OtherTags.Next())
if (MyTagMap.Lookup(pOtherTag->Str(), pTag))
pTag->SetIndex(pTag->Index()+1);
}
}
}
}
for (Strng *pTag=MyTags.First(); pTag; pTag=MyTags.Next())
{
if (pTag->Index()>0)
nTagsMultPgs++;
}
int Ret=IDYES;
if (WithPrompts)
{
CString S;
if (nTagsMultPgs)
S.Format("Do you want Delete %i Units (%i Units have Multiple References)", nTags-nTagsMultPgs, nTagsMultPgs);
else
S.Format("Do you want Delete %i Units", nTags);
Ret=AfxMessageBox(S, MB_ICONQUESTION|MB_YESNOCANCEL);
}
if (Ret==IDCANCEL)
return -1;
if (Ret==IDYES)
{
Strng_List DelTags;
int nMdlDeletes=0;
int nDeletesFailedCnt=0;
for (Strng *pTag=MyTags.First(); pTag; pTag=MyTags.Next())
{
if (pTag->Index()==0)
{
DelTags.Append(pTag->Str());
}
}
int RetCode = gs_Exec.DeleteTags(DelTags);
for (Strng *pTag=DelTags.First(); pTag; pTag=MyTags.Next())
{
if (pTag->Index()!=EODT_DONE)
{
//dbgpln("Mdl Not Deleted %s", pTag->Str());
LogError(pTag->Str(), 0, "Model not deleted");
nDeletesFailedCnt++;
}
else
{
//dbgpln("Mdl Deleted %s", pTag->Str());
nMdlDeletes++;
}
}
if (nDeletesFailedCnt)
{
CString S;
S.Format("%i Units Failed to Delete", nDeletesFailedCnt);
AfxMessageBox(S, MB_ICONEXCLAMATION|MB_OK);
}
}
}
return nTags;
};