本文整理汇总了C++中event::List::find方法的典型用法代码示例。如果您正苦于以下问题:C++ List::find方法的具体用法?C++ List::find怎么用?C++ List::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类event::List
的用法示例。
在下文中一共展示了List::find方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rawEventsForDate
// taking a QDate, this function will look for an eventlist in the dict
// with that date attached -
Event::List ResourceExchange::rawEventsForDate(const QDate &qd,
EventSortField sortField,
SortDirection sortDirection)
{
if(!mCache) return Event::List();
// If the events for this date are not in the cache, or if they are old,
// get them again
QDateTime now = QDateTime::currentDateTime();
// kdDebug() << "Now is " << now.toString() << endl;
// kdDebug() << "mDates: " << mDates << endl;
QDate start = QDate(qd.year(), qd.month(), 1); // First day of month
if(mDates && (!mDates->contains(start) ||
(*mCacheDates)[start].secsTo(now) > mCachedSeconds))
{
QDate end = start.addMonths(1).addDays(-1); // Last day of month
// Get events that occur in this period from the cache
Event::List oldEvents = mCache->rawEvents(start, end, false);
// And remove them all
Event::List::ConstIterator it;
for(it = oldEvents.begin(); it != oldEvents.end(); ++it)
{
mCache->deleteEvent(*it);
}
// FIXME: This is needed for the hack below:
Event::List eventsBefore = mCache->rawEvents();
kdDebug() << "Reading events for month of " << start.toString() << endl;
mClient->downloadSynchronous(mCache, start, end, true); // Show progress dialog
// FIXME: This is a terrible hack! We need to install the observer for
// newly downloaded events.However, downloading is done by
// mClient->downloadSynchronous, where we don't have the pointer to this
// available... On the other hand, here we don't really know which events
// are really new.
Event::List eventsAfter = mCache->rawEvents();
for(it = eventsAfter.begin(); it != eventsAfter.end(); ++it)
{
if(eventsBefore.find(*it) == eventsBefore.end())
{
// it's a new event downloaded by downloadSynchronous -> install observer
(*it)->registerObserver(this);
}
}
mDates->add(start);
mCacheDates->insert(start, now);
}
// Events are safely in the cache now, return them from cache
Event::List events;
if(mCache)
events = mCache->rawEventsForDate(qd, sortField, sortDirection);
// kdDebug() << "Found " << events.count() << " events." << endl;
return events;
}