~ubuntu-branches/ubuntu/oneiric/psi/oneiric

« back to all changes in this revision

Viewing changes to iris/src/xmpp/xmpp-im/xmpp_xmlcommon.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2009-09-25 17:49:51 UTC
  • mfrom: (6.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090925174951-lvm7kdap82o8xhn3
Tags: 0.13-1
* Updated to upstream version 0.13
* Set Standards-Version to 3.8.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * xmlcommon.h - helper functions for dealing with XML
 
3
 * Copyright (C) 2001, 2002  Justin Karneges
 
4
 *
 
5
 * This library is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU Lesser General Public
 
7
 * License as published by the Free Software Foundation; either
 
8
 * version 2.1 of the License, or (at your option) any later version.
 
9
 *
 
10
 * This library is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
 * Lesser General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU Lesser General Public
 
16
 * License along with this library; if not, write to the Free Software
 
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
 *
 
19
 */
 
20
 
 
21
#ifndef JABBER_XMLCOMMON_H
 
22
#define JABBER_XMLCOMMON_H
 
23
 
 
24
#include <qdom.h>
 
25
#include <qlist.h>
 
26
 
 
27
class QDateTime;
 
28
class QRect;
 
29
class QSize;
 
30
class QColor;
 
31
class QStringList;
 
32
 
 
33
class XDomNodeList
 
34
{
 
35
public:
 
36
        XDomNodeList();
 
37
        XDomNodeList(const XDomNodeList &from);
 
38
        XDomNodeList(const QDomNodeList &from);
 
39
        ~XDomNodeList();
 
40
        XDomNodeList & operator=(const XDomNodeList &from);
 
41
 
 
42
        QDomNode at(int index) const { return item(index); }
 
43
        int count() const { return (int)length(); }
 
44
        bool isEmpty() const;
 
45
        QDomNode item(int index) const;
 
46
        uint length() const;
 
47
        int size() const { return (int)length(); }
 
48
 
 
49
        void append(const QDomNode &i);
 
50
 
 
51
        bool operator==(const XDomNodeList &a) const;
 
52
 
 
53
        bool operator!=(const XDomNodeList &a) const
 
54
        {
 
55
                return !operator==(a);
 
56
        }
 
57
 
 
58
private:
 
59
        QList<QDomNode> list;
 
60
};
 
61
 
 
62
QDateTime stamp2TS(const QString &ts);
 
63
bool stamp2TS(const QString &ts, QDateTime *d);
 
64
QString TS2stamp(const QDateTime &d);
 
65
QDomElement textTag(QDomDocument *doc, const QString &name, const QString &content);
 
66
QString tagContent(const QDomElement &e);
 
67
QDomElement findSubTag(const QDomElement &e, const QString &name, bool *found);
 
68
XDomNodeList childElementsByTagNameNS(const QDomElement &e, const QString &nsURI, const QString &localName);
 
69
QDomElement createIQ(QDomDocument *doc, const QString &type, const QString &to, const QString &id);
 
70
QDomElement queryTag(const QDomElement &e);
 
71
QString queryNS(const QDomElement &e);
 
72
void getErrorFromElement(const QDomElement &e, const QString &baseNS, int *code, QString *str);
 
73
QDomElement addCorrectNS(const QDomElement &e);
 
74
 
 
75
namespace XMLHelper {
 
76
        //QDomElement findSubTag(const QDomElement &e, const QString &name, bool *found);
 
77
        bool hasSubTag(const QDomElement &e, const QString &name);
 
78
 
 
79
        QDomElement emptyTag(QDomDocument *doc, const QString &name);
 
80
        QString subTagText(const QDomElement &e, const QString &name);
 
81
 
 
82
        QDomElement textTag(QDomDocument &doc, const QString &name, const QString &content);
 
83
        QDomElement textTag(QDomDocument &doc, const QString &name, int content);
 
84
        QDomElement textTag(QDomDocument &doc, const QString &name, bool content);
 
85
        QDomElement textTag(QDomDocument &doc, const QString &name, QSize &s);
 
86
        QDomElement textTag(QDomDocument &doc, const QString &name, QRect &r);
 
87
        QDomElement stringListToXml(QDomDocument &doc, const QString &name, const QStringList &l);
 
88
 
 
89
        void readEntry(const QDomElement &e, const QString &name, QString *v);
 
90
        void readNumEntry(const QDomElement &e, const QString &name, int *v);
 
91
        void readBoolEntry(const QDomElement &e, const QString &name, bool *v);
 
92
        void readSizeEntry(const QDomElement &e, const QString &name, QSize *v);
 
93
        void readRectEntry(const QDomElement &e, const QString &name, QRect *v);
 
94
        void readColorEntry(const QDomElement &e, const QString &name, QColor *v);
 
95
 
 
96
        void xmlToStringList(const QDomElement &e, const QString &name, QStringList *v);
 
97
 
 
98
        void setBoolAttribute(QDomElement e, const QString &name, bool b);
 
99
        void readBoolAttribute(QDomElement e, const QString &name, bool *v);
 
100
 
 
101
        //QString tagContent(const QDomElement &e); // obsolete;
 
102
}
 
103
 
 
104
#endif