本文整理汇总了C++中event::List类的典型用法代码示例。如果您正苦于以下问题:C++ List类的具体用法?C++ List怎么用?C++ List使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了List类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:31,代码来源:resourcecached.cpp
示例2: cal
Incidence *ICalFormat::fromString(const QString &text)
{
CalendarLocal cal(mTimeZoneId);
fromString(&cal, text);
Incidence *ical = 0;
Event::List elist = cal.events();
if(elist.count() > 0)
{
ical = elist.first();
}
else
{
Todo::List tlist = cal.todos();
if(tlist.count() > 0)
{
ical = tlist.first();
}
else
{
Journal::List jlist = cal.journals();
if(jlist.count() > 0)
{
ical = jlist.first();
}
}
}
return ical ? ical->clone() : 0;
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:30,代码来源:icalformat.cpp
示例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;
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:28,代码来源:resourceexchange.cpp
示例4: event
TEST(EventListTest, testSize)
{
Event::List list;
EXPECT_EQ(0, list.size());
Event event(0, EventType::NOTE);
list.add(event);
EXPECT_EQ(1, list.size());
}
开发者ID:kbinani,项目名称:libvsq,代码行数:8,代码来源:Event.ListTest.cpp
示例5: showInstance
bool KonsoleKalendar::showInstance()
{
bool status = true;
QFile f;
QString title;
Event::Ptr event;
const KDateTime::Spec timeSpec = m_variables->getCalendar()->timeSpec();
Akonadi::CalendarBase::Ptr calendar = m_variables->getCalendar();
if (m_variables->isDryRun()) {
cout << i18n("View Events <Dry Run>:").toLocal8Bit().data()
<< endl;
printSpecs();
} else {
qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |"
<< "open export file";
if (m_variables->isExportFile()) {
f.setFileName(m_variables->getExportFile());
if (!f.open(QIODevice::WriteOnly)) {
status = false;
qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |"
<< "unable to open export file"
<< m_variables->getExportFile();
}
} else {
f.open(stdout, QIODevice::WriteOnly);
}
if (status) {
qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |"
<< "opened successful";
if (m_variables->isVerbose()) {
cout << i18n("View Event <Verbose>:").toLocal8Bit().data()
<< endl;
printSpecs();
}
QTextStream ts(&f);
if (m_variables->getExportType() != ExportTypeHTML &&
m_variables->getExportType() != ExportTypeMonthHTML) {
if (m_variables->getAll()) {
qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |"
<< "view all events sorted list";
Event::List sortedList = calendar->events(EventSortStartDate);
qCDebug(KONSOLEKALENDAR_LOG) << "Found" << sortedList.count() << "events";
if (!sortedList.isEmpty()) {
// The code that was here before the akonadi port was really slow with 200 events
// this is much faster:
foreach (const KCalCore::Event::Ptr &event, sortedList) {
status &= printEvent(&ts, event, event->dtStart().date());
}
}
} else if (m_variables->isUID()) {
开发者ID:KDE,项目名称:kdepim,代码行数:58,代码来源:konsolekalendar.cpp
示例6: loadTemplate
void KOEventEditor::loadTemplate( CalendarLocal &cal )
{
Event::List events = cal.events();
if ( events.count() == 0 ) {
KMessageBox::error( this, i18nc( "@info", "Template does not contain a valid event." ) );
} else {
readEvent( events.first(), QDate(), true );
}
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:9,代码来源:koeventeditor.cpp
示例7: 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";
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:56,代码来源:htmlexport.cpp
示例8: 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;
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:55,代码来源:icalformat.cpp
示例9: a
TEST(EventListTest, testAddWithInternalId)
{
Event::List list;
Event a(0, EventType::NOTE);
Event b(0, EventType::NOTE);
int idOfA = list.add(a, 100);
int idOfB = list.add(b, 2);
EXPECT_EQ(100, idOfA);
EXPECT_EQ(2, idOfB);
EXPECT_EQ(100, list.get(0)->id);
EXPECT_EQ(2, list.get(1)->id);
}
开发者ID:kbinani,项目名称:libvsq,代码行数:12,代码来源:Event.ListTest.cpp
示例10: createEventList
void HtmlExport::createEventList(QTextStream *ts)
{
int columns = 3;
*ts << "<table border=\"0\" cellpadding=\"3\" cellspacing=\"3\">" << endl;
*ts << " <tr>" << endl;
*ts << " <th class=\"sum\">" << i18nc("@title:column event start time",
"Start Time") << "</th>" << endl;
*ts << " <th>" << i18nc("@title:column event end time",
"End Time") << "</th>" << endl;
*ts << " <th>" << i18nc("@title:column event description",
"Event") << "</th>" << endl;
if (d->mSettings->eventLocation()) {
*ts << " <th>" << i18nc("@title:column event locatin",
"Location") << "</th>" << endl;
++columns;
}
if (d->mSettings->eventCategories()) {
*ts << " <th>" << i18nc("@title:column event categories",
"Categories") << "</th>" << endl;
++columns;
}
if (d->mSettings->eventAttendees()) {
*ts << " <th>" << i18nc("@title:column event attendees",
"Attendees") << "</th>" << endl;
++columns;
}
*ts << " </tr>" << endl;
for (QDate dt = fromDate(); dt <= toDate(); dt = dt.addDays(1)) {
qCDebug(KCALUTILS_LOG) << "Getting events for" << dt.toString();
Event::List events = d->mCalendar->events(dt, d->mCalendar->timeSpec(),
EventSortStartDate,
SortDirectionAscending);
if (events.count()) {
*ts << " <tr><td colspan=\"" << QString::number(columns)
<< "\" class=\"datehead\"><i>"
<< QLocale().toString(dt)
<< "</i></td></tr>" << endl;
Event::List::ConstIterator it;
for (it = events.constBegin(); it != events.constEnd(); ++it) {
if (checkSecrecy(*it)) {
createEvent(ts, *it, dt);
}
}
}
}
*ts << "</table>" << endl;
}
开发者ID:KDE,项目名称:kcalutils,代码行数:51,代码来源:htmlexport.cpp
示例11: 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;
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:58,代码来源:resourceexchange.cpp
示例12: createDropEvent
Event::Ptr DndFactory::createDropEvent( const QMimeData *mimeData )
{
//kDebug();
Event::Ptr event;
MemoryCalendar::Ptr calendar( createDropCalendar( mimeData ) );
if ( calendar ) {
Event::List events = calendar->events();
if ( !events.isEmpty() ) {
event = Event::Ptr( new Event( *events.first() ) );
}
}
return event;
}
开发者ID:pvuorela,项目名称:kcalcore,代码行数:14,代码来源:dndfactory.cpp
示例13: kDebug
Event *DndFactory::createDropEvent( const QMimeData *md )
{
kDebug();
Event *ev = 0;
Calendar *cal = createDropCalendar( md );
if ( cal ) {
Event::List events = cal->events();
if ( !events.isEmpty() ) {
ev = new Event( *events.first() );
}
delete cal;
}
return ev;
}
开发者ID:pvuorela,项目名称:kcalcore,代码行数:15,代码来源:dndfactory.cpp
示例14: 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;
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:20,代码来源:calendar.cpp
示例15: singerEvent
TEST(EventListTest, testIterator)
{
Event::List list;
Event::ListIterator iterator = list.iterator();
EXPECT_TRUE(false == iterator.hasNext());
Event singerEvent(0, EventType::SINGER);
singerEvent.singerHandle = Handle(HandleType::SINGER);
list.add(singerEvent, 1);
Event crescendoEvent(240, EventType::ICON);
crescendoEvent.iconDynamicsHandle = Handle(HandleType::DYNAMICS);
crescendoEvent.iconDynamicsHandle.iconId = "$05020001";
list.add(crescendoEvent, 2);
iterator = list.iterator();
EXPECT_TRUE(iterator.hasNext());
EXPECT_EQ((tick_t)0, iterator.next()->tick);
EXPECT_TRUE(iterator.hasNext());
EXPECT_EQ((tick_t)240, iterator.next()->tick);
EXPECT_TRUE(false == iterator.hasNext());
}
开发者ID:kbinani,项目名称:libvsq,代码行数:22,代码来源:Event.ListTest.cpp
示例16: checkAlarmTypes
/******************************************************************************
* Check whether the alarm types in a calendar correspond with the resource's
* alarm type.
* Reply = true if at least 1 alarm is the right type.
*/
bool AlarmResource::checkAlarmTypes(KCal::CalendarLocal& calendar) const
{
KCalEvent::Status type = kcalEventType();
if (type != KCalEvent::EMPTY)
{
bool have = false;
bool other = false;
const Event::List events = calendar.rawEvents();
for (int i = 0, iend = events.count(); i < iend; ++i)
{
KCalEvent::Status s = KCalEvent::status(events[i]);
if (type == s)
have = true;
else
other = true;
if (have && other)
break;
}
if (!have && other)
return false; // contains only wrong alarm types
}
return true;
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:28,代码来源:alarmresource.cpp
示例17: b
TEST(EventListTest, testClear)
{
Event::List list;
Event b(480, EventType::NOTE);
Event a(0, EventType::NOTE);
list.add(b, 14);
list.add(a, 20);
EXPECT_EQ(2, list.size());
EXPECT_EQ(20, list.get(0)->id);
list.clear();
EXPECT_EQ(0, list.size());
}
开发者ID:kbinani,项目名称:libvsq,代码行数:15,代码来源:Event.ListTest.cpp
示例18: kDebug
//@cond PRIVATE
void FreeBusy::Private::init( const Event::List &eventList,
const KDateTime &start, const KDateTime &end )
{
int extraDays, i, x, duration;
duration = start.daysTo( end );
QDate day;
KDateTime tmpStart;
KDateTime tmpEnd;
// Loops through every event in the calendar
Event::List::ConstIterator it;
for ( it = eventList.constBegin(); it != eventList.constEnd(); ++it ) {
Event::Ptr event = *it;
// If this event is transparent it shouldn't be in the freebusy list.
if ( event->transparency() == Event::Transparent ) {
continue;
}
// The code below can not handle all-day events. Fixing this resulted
// in a lot of duplicated code. Instead, make a copy of the event and
// set the period to the full day(s). This trick works for recurring,
// multiday, and single day all-day events.
Event::Ptr allDayEvent;
if ( event->allDay() ) {
// addDay event. Do the hack
kDebug() << "All-day event";
allDayEvent = Event::Ptr( new Event( *event ) );
// Set the start and end times to be on midnight
KDateTime st = allDayEvent->dtStart();
st.setTime( QTime( 0, 0 ) );
KDateTime nd = allDayEvent->dtEnd();
nd.setTime( QTime( 23, 59, 59, 999 ) );
allDayEvent->setAllDay( false );
allDayEvent->setDtStart( st );
allDayEvent->setDtEnd( nd );
kDebug() << "Use:" << st.toString() << "to" << nd.toString();
// Finally, use this event for the setting below
event = allDayEvent;
}
// This whole for loop is for recurring events, it loops through
// each of the days of the freebusy request
for ( i = 0; i <= duration; ++i ) {
day = start.addDays( i ).date();
tmpStart.setDate( day );
tmpEnd.setDate( day );
if ( event->recurs() ) {
if ( event->isMultiDay() ) {
// FIXME: This doesn't work for sub-daily recurrences or recurrences with
// a different time than the original event.
extraDays = event->dtStart().daysTo( event->dtEnd() );
for ( x = 0; x <= extraDays; ++x ) {
if ( event->recursOn( day.addDays( -x ), start.timeSpec() ) ) {
tmpStart.setDate( day.addDays( -x ) );
tmpStart.setTime( event->dtStart().time() );
tmpEnd = event->duration().end( tmpStart );
addLocalPeriod( q, tmpStart, tmpEnd );
break;
}
}
} else {
if ( event->recursOn( day, start.timeSpec() ) ) {
tmpStart.setTime( event->dtStart().time() );
tmpEnd.setTime( event->dtEnd().time() );
addLocalPeriod ( q, tmpStart, tmpEnd );
}
}
}
}
// Non-recurring events
addLocalPeriod( q, event->dtStart(), event->dtEnd() );
}
q->sortList();
}
开发者ID:pvuorela,项目名称:kcalcore,代码行数:84,代码来源:freebusy.cpp
示例19:
TEST(EventListTest, testConstruct)
{
Event::List list;
EXPECT_EQ(0, list.size());
}
开发者ID:kbinani,项目名称:libvsq,代码行数:5,代码来源:Event.ListTest.cpp
示例20: _nextPosition
/**
* @brief 反復子の次の要素を探索する
* @return (int) 次のインデックス
*/
int _nextPosition() const{
int count = _list->size();
for( int i = _pos + 1; i < count; ++i ){
const Event *item = _list->get( i );
if( _kindSinger ){
if( item->type == EventType::SINGER ){
return i;
}
}
if( _kindNote ){
if( item->type == EventType::NOTE ){
return i;
}
}
if( _kindDynaff || _kindCrescend || _kindDecrescend ){
if( item->type == EventType::ICON
&& item->iconDynamicsHandle.getHandleType() != HandleType::UNKNOWN )
{
if( _kindDynaff ){
if( item->iconDynamicsHandle.isDynaffType() ){
return i;
}
}
if( _kindCrescend ){
if( item->iconDynamicsHandle.isCrescendType() ){
return i;
}
}
if( _kindDecrescend ){
if( item->iconDynamicsHandle.isDecrescendType() ){
return i;
}
}
}
}
}
return -1;
}
开发者ID:qtau-devgroup,项目名称:libvsq,代码行数:42,代码来源:EventListIndexIterator.hpp
注:本文中的event::List类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论