本文整理汇总了C++中CList::GetTail方法的典型用法代码示例。如果您正苦于以下问题:C++ CList::GetTail方法的具体用法?C++ CList::GetTail怎么用?C++ CList::GetTail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CList
的用法示例。
在下文中一共展示了CList::GetTail方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SegmentationGlob
CAVector CToolCervicales::SegmentationGlob(CDib * m_Dib, CRxDoc * i_Document, CList<CPoint, CPoint&>& i_List) {
CList<CPoint, CPoint&> Result;
Result.AddTail(i_List.GetHead());
Segmentation(m_Dib, i_Document, i_List.GetHeadPosition(), i_List.GetTailPosition(), i_List, 0, Result);
Result.AddTail(i_List.GetTail());
CAVector Vector; CPoint l_Point;
POSITION c_Pos = Result.GetHeadPosition();
while (c_Pos != NULL) {
l_Point = Result.GetNext(c_Pos);
Vector.Add(CPoint(l_Point.x, m_Dib->GetHeight()-l_Point.y));
}
/* replace very close points by an intermediate value */
for (int i=2;i<(int)((double)(m_Dib->GetWidth() + m_Dib->GetHeight())/2 * 0.03);i++) RemoveClosePoints(Vector, i);
/* remove pattern points */
RemovePatternPoints(Vector);
//i_Document->Add(Vector);
return Vector;
}
示例2: OnLvnKeyDown
void CPlayerPlaylistBar::OnLvnKeyDown(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMLVKEYDOWN pLVKeyDown = reinterpret_cast<LPNMLVKEYDOWN>(pNMHDR);
*pResult = FALSE;
CList<int> items;
POSITION pos = m_list.GetFirstSelectedItemPosition();
while (pos) {
items.AddHead(m_list.GetNextSelectedItem(pos));
}
if (pLVKeyDown->wVKey == VK_DELETE && items.GetCount() > 0) {
pos = items.GetHeadPosition();
while (pos) {
int i = items.GetNext(pos);
if (m_pl.RemoveAt(FindPos(i))) {
((CMainFrame*)AfxGetMainWnd())->CloseMedia();
}
m_list.DeleteItem(i);
}
m_list.SetItemState(-1, 0, LVIS_SELECTED);
m_list.SetItemState(
max(min(items.GetTail(), m_list.GetItemCount() - 1), 0),
LVIS_SELECTED, LVIS_SELECTED);
ResizeListColumn();
*pResult = TRUE;
} else if (pLVKeyDown->wVKey == VK_SPACE && items.GetCount() == 1) {
m_pl.SetPos(FindPos(items.GetHead()));
((CMainFrame*)AfxGetMainWnd())->OpenCurPlaylistItem();
AfxGetMainWnd()->SetFocus();
*pResult = TRUE;
}
}
示例3: DoParse
//************************************************************************************
void CBCGPOutlineParser::DoParse (const CString& strBuffer,
const int nStartOffset, const int nEndOffset,
CObList& lstResults)
{
ASSERT (nStartOffset >= 0);
ASSERT (nEndOffset < strBuffer.GetLength ());
ASSERT (nStartOffset <= nEndOffset);
m_strOut.Empty ();
CList <Lexeme, Lexeme&> lstStack;
Lexeme lexemStackTop (0, LT_Eps, 0, 0);
lstStack.AddTail (lexemStackTop);
int nOffset = nStartOffset;
while (nOffset <= nEndOffset)
{
// Get next lexem:
Lexeme lexemNext = GetNext (strBuffer, nOffset, nEndOffset);
Lexeme lexemTop = lstStack.GetTail ();
if (lexemNext.m_nType == LT_EndOfText)
{
break;
}
// Parser logic:
switch (lexemNext.m_nType)
{
case LT_BlockStart:
lstStack.AddTail (lexemNext);
break;
case LT_BlockEnd:
if (lexemTop.m_nType == LT_BlockStart &&
lexemTop.m_nBlockType == lexemNext.m_nBlockType)
{
// Push Block:
lstStack.RemoveTail ();
Lexeme lexemRes (lexemTop.m_nBlockType, LT_CompleteBlock, lexemTop.m_nStart, lexemNext.m_nEnd);
PushResult (lexemRes, lstResults);
}
else
{
lstStack.AddTail (lexemNext);
}
break;
case LT_CompleteBlock:
{
// Push Comment:
PushResult (lexemNext, lstResults);
}
break;
case LT_CustomBlock:
break;
}
}
// Finish parsing:
while (!lstStack.IsEmpty ())
{
Lexeme lexem = lstStack.RemoveTail ();
PushResult (lexem, lstResults);
}
}
示例4: ParseHelper
bool Template::ParseHelper()
{
// Build our master string.
m_helper->m_buffer.SetCount(0, 1024);
m_helper->m_outBolPos = 0;
// Start copying the string in.
m_helper->m_codePtr = (LPCTSTR)m_code;
m_helper->m_codeBolPtr = m_helper->m_codePtr;
LPCTSTR& codePtr = m_helper->m_codePtr;
CharArray& buffer = m_helper->m_buffer;
// Conditional stack.
CList<CondInfo, CondInfo&> conditionalStack;
int nestedFalseConditionals = 0;
// Go 'til the end.
while (*codePtr != 0)
{
LPCTSTR outBolPtr = buffer.GetData() + m_helper->m_outBolPos;
TokenHelper helper;
helper.m_tabSize = m_helper->m_tabSize;
helper.m_outBolPtr = outBolPtr;
helper.m_file = this;
helper.m_helper = m_helper;
// See if it is a command. Commands can only occur at the beginning
// of a line.
if (*codePtr == '!' && *(codePtr + 1) == '!' && codePtr == m_helper->m_codeBolPtr)
{
// Move past the exclamation points.
codePtr += 2;
// Is it a command comment?
// !!// This is a comment.
if (*codePtr == '/' && *(codePtr + 1) == '/')
{
// Move past the double slash.
codePtr += 2;
SkipToEol(codePtr);
continue;
}
///////////////////////////////////////////////////////////////////
// Lex the command token.
char command[256];
char *comPtr = command;
while (*codePtr != 0)
{
// Is it a space?
if (*codePtr == ' ')
{
// Break at a space.
codePtr++;
break;
}
else if (*codePtr == '\n' || *codePtr == '\r')
{
break;
}
else
{
// Copy the command or flag.
*comPtr++ = *codePtr++;
}
}
*comPtr = 0;
///////////////////////////////////////////////////////////////////
// "Conditional" commands
///////////////////////////////////////////////////////////////////
// If the last conditional was false, then we ignore until the next
// endif.
if (conditionalStack.GetCount() > 0 &&
conditionalStack.GetTail().m_curState == false)
{
CondInfo condInfo = conditionalStack.GetTail();
if (stricmp(command, "if") == 0)
{
SkipToEol(codePtr);
nestedFalseConditionals++;
continue;
}
else if (stricmp(command, "elif") == 0 || stricmp(command, "else") == 0)
{
// If we're in nested false conditionals, then ignore.
if (nestedFalseConditionals > 0)
{
SkipToEol(codePtr);
continue;
}
}
else if (stricmp(command, "endif") == 0)
{
// If we're in nested false conditionals, then ignore.
if (nestedFalseConditionals > 0)
{
//.........这里部分代码省略.........
示例5: CalcButtonLocations
//.........这里部分代码省略.........
stripe = ButtonStripe ();
}
else // usual button
{
if (stripe.breadth + szButton.cx <= nMaxSize)
{
stripe.breadth += szButton.cx;
stripe.buttonCount ++;
if (szButton.cy > stripe.size)
stripe.size = szButton.cy;
}
else
{
if (stripe.buttonCount > 0)
{
listStripes.AddTail (stripe);
}
stripe.buttonCount = 1;
stripe.breadth = szButton.cx; // cy for horz.
stripe.size = szButton.cy; // cx for horz.
}
}
}
bPrevSeparator = bSep;
}
if (stripe.buttonCount > 0)
{
listStripes.AddTail (stripe);
}
if (listStripes.IsEmpty ())
{
return CSize (0, 0);
}
if (listStripes.GetTail ().breadth == 0) // last item is separator
{
listStripes.RemoveTail ();
}
// Now calculate total size
int totalLength = m_nCaptionHeight + 4;
int maxBreadth = nMaxSize;
POSITION posStripes = listStripes.GetHeadPosition ();
while (posStripes != NULL)
{
stripe = listStripes.GetNext (posStripes);
ASSERT (stripe.buttonCount > 0);
totalLength += stripe.size;
if (stripe.breadth > maxBreadth)
{
maxBreadth = stripe.breadth;
}
}
if (!bCalcOnly)
{
CPoint ptButtonPos = rectClient.TopLeft ();
posStripes = listStripes.GetHeadPosition ();
stripe = ButtonStripe();
for (POSITION pos = m_Buttons.GetHeadPosition (); pos != NULL;)
{
pButton = (CBCGPToolbarButton*)m_Buttons.GetNext (pos);
if (pButton == NULL)
{
break;