1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/*
* xmlcommon.h - helper functions for dealing with XML
* Copyright (C) 2001, 2002 Justin Karneges
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef JABBER_XMLCOMMON_H
#define JABBER_XMLCOMMON_H
#include<qdom.h>
class QDateTime;
class QRect;
class QSize;
class QColor;
class QStringList;
bool stamp2TS(const QString &ts, QDateTime *d);
QString TS2stamp(const QDateTime &d);
QDomElement textTag(QDomDocument *doc, const QString &name, const QString &content);
QString tagContent(const QDomElement &e);
QDomElement findSubTag(const QDomElement &e, const QString &name, bool *found);
QDomElement createIQ(QDomDocument *doc, const QString &type, const QString &to, const QString &id);
QDomElement queryTag(const QDomElement &e);
QString queryNS(const QDomElement &e);
void getErrorFromElement(const QDomElement &e, int *code, QString *str);
namespace XMLHelper {
//QDomElement findSubTag(const QDomElement &e, const QString &name, bool *found);
bool hasSubTag(const QDomElement &e, const QString &name);
QDomElement emptyTag(QDomDocument *doc, const QString &name);
QString subTagText(const QDomElement &e, const QString &name);
QDomElement textTag(QDomDocument &doc, const QString &name, const QString &content);
QDomElement textTag(QDomDocument &doc, const QString &name, int content);
QDomElement textTag(QDomDocument &doc, const QString &name, bool content);
QDomElement textTag(QDomDocument &doc, const QString &name, QSize &s);
QDomElement textTag(QDomDocument &doc, const QString &name, QRect &r);
QDomElement stringListToXml(QDomDocument &doc, const QString &name, const QStringList &l);
void readEntry(const QDomElement &e, const QString &name, QString *v);
void readNumEntry(const QDomElement &e, const QString &name, int *v);
void readBoolEntry(const QDomElement &e, const QString &name, bool *v);
void readSizeEntry(const QDomElement &e, const QString &name, QSize *v);
void readRectEntry(const QDomElement &e, const QString &name, QRect *v);
void readColorEntry(const QDomElement &e, const QString &name, QColor *v);
void xmlToStringList(const QDomElement &e, const QString &name, QStringList *v);
void setBoolAttribute(QDomElement e, const QString &name, bool b);
void readBoolAttribute(QDomElement e, const QString &name, bool *v);
//QString tagContent(const QDomElement &e); // obsolete;
}
#endif
|