aboutsummaryrefslogtreecommitdiff
path: root/source/QXmppElement.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2010-02-18 12:37:52 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2010-02-18 12:37:52 +0000
commit54576ab2d36c6736d3720fc4cfbcfc659c279e23 (patch)
tree22b5e62b3e684563d71a3a2d075b464fa37cefc1 /source/QXmppElement.cpp
parent5479c36ba68c9b06300a0b1b4830d21a5415daf7 (diff)
downloadqxmpp-54576ab2d36c6736d3720fc4cfbcfc659c279e23.tar.gz
introduce QXmppElementList
Diffstat (limited to 'source/QXmppElement.cpp')
-rw-r--r--source/QXmppElement.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/source/QXmppElement.cpp b/source/QXmppElement.cpp
index 3820f35e..5bcbeed6 100644
--- a/source/QXmppElement.cpp
+++ b/source/QXmppElement.cpp
@@ -73,16 +73,24 @@ void QXmppElement::setAttribute(const QString &name, const QString &value)
m_attributes.insert(name, value);
}
-QList<QXmppElement> QXmppElement::children() const
+QXmppElementList QXmppElement::children() const
{
return m_children;
}
-void QXmppElement::setChildren(QList<QXmppElement> &children)
+void QXmppElement::setChildren(const QXmppElementList &children)
{
m_children = children;
}
+QXmppElement QXmppElement::firstChild(const QString &name) const
+{
+ foreach (const QXmppElement &child, m_children)
+ if (child.tagName() == name)
+ return child;
+ return QXmppElement();
+}
+
bool QXmppElement::isNull() const
{
return m_tagName.isEmpty();
@@ -122,3 +130,18 @@ void QXmppElement::toXml(QXmlStreamWriter *writer) const
writer->writeEndElement();
}
+QXmppElementList::QXmppElementList()
+{
+}
+
+QXmppElementList::QXmppElementList(const QXmppElement &element)
+{
+ append(element);
+}
+
+
+QXmppElementList::QXmppElementList(const QList<QXmppElement> &other)
+ : QList<QXmppElement>(other)
+{
+}
+