From 373c0c27a2c38b200f8e91b3b8b39691d92e3046 Mon Sep 17 00:00:00 2001 From: mlaurent Date: Wed, 31 Dec 2008 08:34:59 +0000 Subject: [PATCH] Fix iterator git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/KDE/kdenetwork@903650 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- .../jabber/libiris/iris/xmpp-core/simplesasl.cpp | 8 +++--- .../jabber/libiris/iris/xmpp-im/client.cpp | 2 +- .../jabber/libiris/iris/xmpp-im/types.cpp | 30 +++++++++++----------- .../jabber/libiris/iris/xmpp-im/xmpp_tasks.cpp | 14 +++++----- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/kopete/protocols/jabber/libiris/iris/xmpp-core/simplesasl.cpp b/kopete/protocols/jabber/libiris/iris/xmpp-core/simplesasl.cpp index 723a6f195..3ab573944 100644 --- a/kopete/protocols/jabber/libiris/iris/xmpp-core/simplesasl.cpp +++ b/kopete/protocols/jabber/libiris/iris/xmpp-core/simplesasl.cpp @@ -55,7 +55,7 @@ public: Q3CString get(const Q3CString &var) { - for(ConstIterator it = begin(); it != end(); ++it) { + for(ConstIterator it = constBegin(); it != constEnd(); ++it) { if((*it).var == var) return (*it).val; } @@ -66,7 +66,7 @@ public: { Q3CString str; bool first = true; - for(ConstIterator it = begin(); it != end(); ++it) { + for(ConstIterator it = constBegin(); it != constEnd(); ++it) { if(!first) str += ','; if ((*it).var == "realm" || (*it).var == "nonce" || (*it).var == "username" || (*it).var == "cnonce" || (*it).var == "digest-uri" || (*it).var == "authzid") @@ -144,7 +144,7 @@ public: int varCount(const Q3CString &var) { int n = 0; - for(ConstIterator it = begin(); it != end(); ++it) { + for(ConstIterator it = constBegin(); it != constEnd(); ++it) { if((*it).var == var) ++n; } @@ -154,7 +154,7 @@ public: QStringList getValues(const Q3CString &var) { QStringList list; - for(ConstIterator it = begin(); it != end(); ++it) { + for(ConstIterator it = constBegin(); it != constEnd(); ++it) { if((*it).var == var) list += (*it).val; } diff --git a/kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp b/kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp index e4f4f0dc0..24d190852 100644 --- a/kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp +++ b/kopete/protocols/jabber/libiris/iris/xmpp-im/client.cpp @@ -354,7 +354,7 @@ void Client::groupChatSetStatus(const QString &host, const QString &room, const { Jid jid(room + "@" + host); bool found = false; - for(QList::ConstIterator it = d->groupChatList.begin(); it != d->groupChatList.end(); it++) { + for(QList::ConstIterator it = d->groupChatList.constBegin(); it != d->groupChatList.constEnd(); ++it) { const GroupChat &i = *it; if(i.j.compare(jid, false)) { found = true; diff --git a/kopete/protocols/jabber/libiris/iris/xmpp-im/types.cpp b/kopete/protocols/jabber/libiris/iris/xmpp-im/types.cpp index 94f2f805f..10405d01d 100644 --- a/kopete/protocols/jabber/libiris/iris/xmpp-im/types.cpp +++ b/kopete/protocols/jabber/libiris/iris/xmpp-im/types.cpp @@ -1016,7 +1016,7 @@ QString Message::body(const QString &lang) const else if (d->body.contains(lang)) return d->body[lang]; else - return d->body.begin().value(); + return d->body.constBegin().value(); } //! \brief Return xhtml body. @@ -1031,7 +1031,7 @@ HTMLElement Message::html(const QString &lang) const if (d->htmlElements.contains(lang)) return d->htmlElements[lang]; else - return d->htmlElements.begin().value(); + return d->htmlElements.constBegin().value(); } else return HTMLElement(); @@ -1431,7 +1431,7 @@ Stanza Message::toStanza(Stream *stream) const s.setLang(d->lang); StringMap::ConstIterator it; - for(it = d->subject.begin(); it != d->subject.end(); ++it) { + for(it = d->subject.constBegin(); it != d->subject.constEnd(); ++it) { const QString &str = it.data(); if(!str.isEmpty()) { QDomElement e = s.createTextElement(s.baseNS(), "subject", str); @@ -1440,7 +1440,7 @@ Stanza Message::toStanza(Stream *stream) const s.appendChild(e); } } - for(it = d->body.begin(); it != d->body.end(); ++it) { + for(it = d->body.constBegin(); it != d->body.constEnd(); ++it) { const QString &str = it.data(); if(!str.isEmpty()) { QDomElement e = s.createTextElement(s.baseNS(), "body", str); @@ -1467,7 +1467,7 @@ Stanza Message::toStanza(Stream *stream) const } // urls - for(QList::ConstIterator uit = d->urlList.begin(); uit != d->urlList.end(); ++uit) { + for(QList::ConstIterator uit = d->urlList.constBegin(); uit != d->urlList.constEnd(); ++uit) { QDomElement x = s.createElement("jabber:x:oob", "x"); x.appendChild(s.createTextElement("jabber:x:oob", "url", (*uit).url())); if(!(*uit).desc().isEmpty()) @@ -1486,7 +1486,7 @@ Stanza Message::toStanza(Stream *stream) const x.appendChild(s.createTextElement("jabber:x:event","id",d->eventId)); } - for(QList::ConstIterator ev = d->eventList.begin(); ev != d->eventList.end(); ++ev) { + for(QList::ConstIterator ev = d->eventList.constBegin(); ev != d->eventList.constEnd(); ++ev) { switch (*ev) { case OfflineEvent: x.appendChild(s.createElement("jabber:x:event", "offline")); @@ -2498,20 +2498,20 @@ ResourceList::Iterator ResourceList::priority() ResourceList::ConstIterator ResourceList::find(const QString & _find) const { - for(ResourceList::ConstIterator it = begin(); it != end(); ++it) { + for(ResourceList::ConstIterator it = constBegin(); it != constEnd(); ++it) { if((*it).name() == _find) return it; } - return end(); + return constEnd(); } ResourceList::ConstIterator ResourceList::priority() const { - ResourceList::ConstIterator highest = end(); + ResourceList::ConstIterator highest = constEnd(); - for(ResourceList::ConstIterator it = begin(); it != end(); ++it) { - if(highest == end() || (*it).priority() > (*highest).priority()) + for(ResourceList::ConstIterator it = constBegin(); it != constEnd(); ++it) { + if(highest == constEnd() || (*it).priority() > (*highest).priority()) highest = it; } @@ -2564,7 +2564,7 @@ bool RosterItem::isPush() const bool RosterItem::inGroup(const QString &g) const { - for(QStringList::ConstIterator it = v_groups.begin(); it != v_groups.end(); ++it) { + for(QStringList::ConstIterator it = v_groups.constBegin(); it != v_groups.constEnd(); ++it) { if(*it == g) return true; } @@ -2630,7 +2630,7 @@ QDomElement RosterItem::toXml(QDomDocument *doc) const item.setAttribute("subscription", v_subscription.toString()); if(!v_ask.isEmpty()) item.setAttribute("ask", v_ask); - for(QStringList::ConstIterator it = v_groups.begin(); it != v_groups.end(); ++it) + for(QStringList::ConstIterator it = v_groups.constBegin(); it != v_groups.constEnd(); ++it) item.appendChild(textTag(doc, "group", *it)); return item; @@ -2691,12 +2691,12 @@ Roster::Iterator Roster::find(const Jid &j) Roster::ConstIterator Roster::find(const Jid &j) const { - for(Roster::ConstIterator it = begin(); it != end(); ++it) { + for(Roster::ConstIterator it = constBegin(); it != constEnd(); ++it) { if((*it).jid().compare(j)) return it; } - return end(); + return constEnd(); } diff --git a/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_tasks.cpp b/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_tasks.cpp index bee6f3a4e..914741714 100644 --- a/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_tasks.cpp +++ b/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_tasks.cpp @@ -420,7 +420,7 @@ void JT_Roster::onGo() QDomElement query = doc()->createElement("query"); query.setAttribute("xmlns", "jabber:iq:roster"); iq.appendChild(query); - for(QList::ConstIterator it = d->itemList.begin(); it != d->itemList.end(); ++it) + for(QList::ConstIterator it = d->itemList.constBegin(); it != d->itemList.constEnd(); ++it) query.appendChild(*it); send(iq); } @@ -438,7 +438,7 @@ QString JT_Roster::toString() const QDomElement i = doc()->createElement("request"); i.setAttribute("type", "JT_Roster"); - for(QList::ConstIterator it = d->itemList.begin(); it != d->itemList.end(); ++it) + for(QList::ConstIterator it = d->itemList.constBegin(); it != d->itemList.constEnd(); ++it) i.appendChild(*it); return lineEncode(Stream::xmlToString(i)); return ""; @@ -1412,8 +1412,8 @@ bool JT_ServInfo::take(const QDomElement &e) query.appendChild(feature); // Client-specific features - QStringList clientFeatures = client()->features().list(); - for (QStringList::ConstIterator i = clientFeatures.begin(); i != clientFeatures.end(); ++i) { + const QStringList clientFeatures = client()->features().list(); + for (QStringList::ConstIterator i = clientFeatures.constBegin(); i != clientFeatures.constEnd(); ++i) { feature = doc()->createElement("feature"); feature.setAttribute("var", *i); query.appendChild(feature); @@ -1421,10 +1421,10 @@ bool JT_ServInfo::take(const QDomElement &e) if (node.isEmpty()) { // Extended features - QStringList exts = client()->extensions(); - for (QStringList::ConstIterator i = exts.begin(); i != exts.end(); ++i) { + const QStringList exts = client()->extensions(); + for (QStringList::ConstIterator i = exts.constBegin(); i != exts.constEnd(); ++i) { const QStringList& l = client()->extension(*i).list(); - for ( QStringList::ConstIterator j = l.begin(); j != l.end(); ++j ) { + for ( QStringList::ConstIterator j = l.constBegin(); j != l.constEnd(); ++j ) { feature = doc()->createElement("feature"); feature.setAttribute("var", *j); query.appendChild(feature); -- 2.11.4.GIT