当前位置: 首页>>代码示例>>C++>>正文


C++ event::List类代码示例

本文整理汇总了C++中event::List的典型用法代码示例。如果您正苦于以下问题:C++ List类的具体用法?C++ List怎么用?C++ List使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了List类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的event::List类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。