本文整理汇总了C++中Token::UnlinkNextToken方法的典型用法代码示例。如果您正苦于以下问题:C++ Token::UnlinkNextToken方法的具体用法?C++ Token::UnlinkNextToken怎么用?C++ Token::UnlinkNextToken使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Token
的用法示例。
在下文中一共展示了Token::UnlinkNextToken方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveSegment
void Speech::RemoveSegment(Segment* currentSegment)
{
list<Token*> listPreviousTokenofFirstToken;
list<Token*> listNextTokenofLastToken;
// Remove links from the previous tokens of the first tokens of the segment
for(size_t f=0; f<currentSegment->GetNumberOfFirstToken(); ++f)
{
Token* firstToken = currentSegment->GetFirstToken(f);
if(firstToken)
{
for(size_t p=0; p<firstToken->GetNbOfPrecTokens(); ++p)
{
Token* previousTokenofFirstToken = firstToken->GetPrecToken(p);
listPreviousTokenofFirstToken.push_back(previousTokenofFirstToken);
previousTokenofFirstToken->UnlinkNextToken(firstToken);
}
}
}
// Remove links from the next tokens of the last tokens of the segment
for(size_t l=0; l<currentSegment->GetNumberOfLastToken(); ++l)
{
Token* lastToken = currentSegment->GetLastToken(l);
if(lastToken)
{
for(size_t n=0; n<lastToken->GetNbOfNextTokens(); ++n)
{
Token* nextTokenofLastToken = lastToken->GetNextToken(n);
listNextTokenofLastToken.push_back(nextTokenofLastToken);
nextTokenofLastToken->UnlinkPrevToken(lastToken);
}
}
}
// Re-attach the tokens
list<Token*>::iterator prev = listPreviousTokenofFirstToken.begin();
list<Token*>::iterator eprev = listPreviousTokenofFirstToken.end();
list<Token*>::iterator next = listNextTokenofLastToken.begin();
list<Token*>::iterator enext = listNextTokenofLastToken.end();
while(prev != eprev)
{
while(next != enext)
{
(*prev)->AddNextToken(*next);
(*next)->AddPrecToken(*prev);
++next;
}
++prev;
}
listPreviousTokenofFirstToken.clear();
listNextTokenofLastToken.clear();
// Remove Segment from vector
vector<Segment*>::iterator SegIter = m_segments.begin();
while (SegIter != m_segments.end() && (*SegIter) != currentSegment)
++SegIter;
if (SegIter == m_segments.end())
{
LOG_FATAL(m_pLogger, "Speech::RemoveSegment(), the segment is not at the right spot!!");
exit(E_INVALID);
}
m_segments.erase(SegIter);
// destroy! the segment now
delete currentSegment;
}