本文整理汇总了C++中event::List::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ List::begin方法的具体用法?C++ List::begin怎么用?C++ List::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类event::List
的用法示例。
在下文中一共展示了List::begin方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cleanUpEventCache
void ResourceCached::cleanUpEventCache(const Event::List &eventList)
{
CalendarLocal calendar(QString::fromLatin1("UTC"));
if(KStandardDirs::exists(cacheFile()))
calendar.load(cacheFile());
else
return;
Event::List list = calendar.events();
Event::List::ConstIterator cacheIt, it;
for(cacheIt = list.begin(); cacheIt != list.end(); ++cacheIt)
{
bool found = false;
for(it = eventList.begin(); it != eventList.end(); ++it)
{
if((*it)->uid() == (*cacheIt)->uid())
found = true;
}
if(!found)
{
mIdMapper.removeRemoteId(mIdMapper.remoteId((*cacheIt)->uid()));
Event *event = mCalendar.event((*cacheIt)->uid());
if(event)
mCalendar.deleteEvent(event);
}
}
calendar.close();
}
示例2: 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;
}
示例3: alarms
/* Invoked by korgac when checking alarms. Always updates the cache. */
Alarm::List ResourceExchange::alarms(const QDateTime &from, const QDateTime &to)
{
kdDebug(5800) << "ResourceExchange::alarms(" << from.toString() << " - " << to.toString() << ")\n";
Alarm::List list;
QDate start = from.date();
QDate end = to.date();
if(mCache)
{
/* Clear the cache */
Event::List oldEvents = mCache->rawEvents(start, end, false);
Event::List::ConstIterator it;
for(it = oldEvents.begin(); it != oldEvents.end(); ++it)
{
mCache->deleteEvent(*it);
}
/* Fetch events */
mClient->downloadSynchronous(mCache, start, end, false);
list = mCache->alarms(from, to);
}
return list;
}
示例4: createEventList
void HtmlExport::createEventList(QTextStream *ts)
{
int columns = 3;
*ts << "<table border=\"0\" cellpadding=\"3\" cellspacing=\"3\">\n";
*ts << " <tr>\n";
*ts << " <th class=\"sum\">" << i18n("Start Time") << "</th>\n";
*ts << " <th>" << i18n("End Time") << "</th>\n";
*ts << " <th>" << i18n("Event") << "</th>\n";
if(mSettings->eventLocation())
{
*ts << " <th>" << i18n("Location") << "</th>\n";
++columns;
}
if(mSettings->eventCategories())
{
*ts << " <th>" << i18n("Categories") << "</th>\n";
++columns;
}
if(mSettings->eventAttendees())
{
*ts << " <th>" << i18n("Attendees") << "</th>\n";
++columns;
}
*ts << " </tr>\n";
for(QDate dt = fromDate(); dt <= toDate(); dt = dt.addDays(1))
{
kdDebug(5850) << "Getting events for " << dt.toString() << endl;
Event::List events = mCalendar->events(dt,
EventSortStartDate,
SortDirectionAscending);
if(events.count())
{
Event::List::ConstIterator it;
bool first = true;
for(it = events.begin(); it != events.end(); ++it)
{
if(checkSecrecy(*it))
{
if(first)
{
*ts << " <tr><td colspan=\"" << QString::number(columns)
<< "\" class=\"datehead\"><i>"
<< KGlobal::locale()->formatDate(dt)
<< "</i></td></tr>\n";
first = false;
}
createEvent(ts, *it, dt);
}
}
}
}
*ts << "</table>\n";
}
示例5: toString
QString ICalFormat::toString(Calendar *cal)
{
setTimeZone(cal->timeZoneId(), !cal->isLocalTime());
icalcomponent *calendar = mImpl->createCalendarComponent(cal);
icalcomponent *component;
// todos
Todo::List todoList = cal->rawTodos();
Todo::List::ConstIterator it;
for(it = todoList.begin(); it != todoList.end(); ++it)
{
// kdDebug(5800) << "ICalFormat::toString() write todo "
// << (*it)->uid() << endl;
component = mImpl->writeTodo(*it);
icalcomponent_add_component(calendar, component);
}
// events
Event::List events = cal->rawEvents();
Event::List::ConstIterator it2;
for(it2 = events.begin(); it2 != events.end(); ++it2)
{
// kdDebug(5800) << "ICalFormat::toString() write event "
// << (*it2)->uid() << endl;
component = mImpl->writeEvent(*it2);
icalcomponent_add_component(calendar, component);
}
// journals
Journal::List journals = cal->journals();
Journal::List::ConstIterator it3;
for(it3 = journals.begin(); it3 != journals.end(); ++it3)
{
kdDebug(5800) << "ICalFormat::toString() write journal "
<< (*it3)->uid() << endl;
component = mImpl->writeJournal(*it3);
icalcomponent_add_component(calendar, component);
}
QString text = QString::fromUtf8(icalcomponent_as_ical_string(calendar));
icalcomponent_free(calendar);
icalmemory_free_ring();
if(!text)
{
setException(new ErrorFormat(ErrorFormat::SaveError,
i18n("libical error")));
return QString::null;
}
return text;
}
示例6: mergeIncidenceList
Incidence::List Calendar::mergeIncidenceList(const Event::List &events,
const Todo::List &todos,
const Journal::List &journals)
{
Incidence::List incidences;
Event::List::ConstIterator it1;
for(it1 = events.begin(); it1 != events.end(); ++it1)
incidences.append(*it1);
Todo::List::ConstIterator it2;
for(it2 = todos.begin(); it2 != todos.end(); ++it2)
incidences.append(*it2);
Journal::List::ConstIterator it3;
for(it3 = journals.begin(); it3 != journals.end(); ++it3)
incidences.append(*it3);
return incidences;
}
示例7: 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;
}
}
//.........这里部分代码省略.........