diff options
Diffstat (limited to 'source/QXmppElement.cpp')
| -rw-r--r-- | source/QXmppElement.cpp | 27 |
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) +{ +} + |
