本文整理汇总了C++中event::List::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ List::insert方法的具体用法?C++ List::insert怎么用?C++ List::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类event::List
的用法示例。
在下文中一共展示了List::insert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sortEvents
Event::List Calendar::sortEvents(Event::List *eventList,
EventSortField sortField,
SortDirection sortDirection)
{
Event::List eventListSorted;
Event::List tempList, t;
Event::List alphaList;
Event::List::Iterator sortIt;
Event::List::Iterator eit;
// Notice we alphabetically presort Summaries first.
// We do this so comparison "ties" stay in a nice order.
switch(sortField)
{
case EventSortUnsorted:
eventListSorted = *eventList;
break;
case EventSortStartDate:
alphaList = sortEvents(eventList, EventSortSummary, sortDirection);
for(eit = alphaList.begin(); eit != alphaList.end(); ++eit)
{
sortIt = eventListSorted.begin();
if(sortDirection == SortDirectionAscending)
{
while(sortIt != eventListSorted.end() &&
(*eit)->dtStart() >= (*sortIt)->dtStart())
{
++sortIt;
}
}
else
{
while(sortIt != eventListSorted.end() &&
(*eit)->dtStart() < (*sortIt)->dtStart())
{
++sortIt;
}
}
eventListSorted.insert(sortIt, *eit);
}
break;
case EventSortEndDate:
alphaList = sortEvents(eventList, EventSortSummary, sortDirection);
for(eit = alphaList.begin(); eit != alphaList.end(); ++eit)
{
if((*eit)->hasEndDate())
{
sortIt = eventListSorted.begin();
if(sortDirection == SortDirectionAscending)
{
while(sortIt != eventListSorted.end() &&
(*eit)->dtEnd() >= (*sortIt)->dtEnd())
{
++sortIt;
}
}
else
{
while(sortIt != eventListSorted.end() &&
(*eit)->dtEnd() < (*sortIt)->dtEnd())
{
++sortIt;
}
}
}
else
{
// Keep a list of the Events without End DateTimes
tempList.append(*eit);
}
eventListSorted.insert(sortIt, *eit);
}
if(sortDirection == SortDirectionAscending)
{
// Append the list of Events without End DateTimes
eventListSorted += tempList;
}
else
{
// Prepend the list of Events without End DateTimes
tempList += eventListSorted;
eventListSorted = tempList;
}
break;
case EventSortSummary:
for(eit = eventList->begin(); eit != eventList->end(); ++eit)
{
sortIt = eventListSorted.begin();
if(sortDirection == SortDirectionAscending)
{
while(sortIt != eventListSorted.end() &&
(*eit)->summary() >= (*sortIt)->summary())
{
++sortIt;
}
}
//.........这里部分代码省略.........