source: psi/trunk/iris/xmpp-im/xmpp_xmlcommon.h

Last change on this file was 2, checked in by dmik, 19 years ago

Imported original Psi 0.10 sources from Affinix

File size: 3.0 KB
Line 
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
26class QDateTime;
27class QRect;
28class QSize;
29class QColor;
30class QStringList;
31
32bool stamp2TS(const QString &ts, QDateTime *d);
33QString TS2stamp(const QDateTime &d);
34QDomElement textTag(QDomDocument *doc, const QString &name, const QString &content);
35QString tagContent(const QDomElement &e);
36QDomElement findSubTag(const QDomElement &e, const QString &name, bool *found);
37QDomElement createIQ(QDomDocument *doc, const QString &type, const QString &to, const QString &id);
38QDomElement queryTag(const QDomElement &e);
39QString queryNS(const QDomElement &e);
40void getErrorFromElement(const QDomElement &e, int *code, QString *str);
41
42namespace XMLHelper {
43 //QDomElement findSubTag(const QDomElement &e, const QString &name, bool *found);
44 bool hasSubTag(const QDomElement &e, const QString &name);
45
46 QDomElement emptyTag(QDomDocument *doc, const QString &name);
47 QString subTagText(const QDomElement &e, const QString &name);
48
49 QDomElement textTag(QDomDocument &doc, const QString &name, const QString &content);
50 QDomElement textTag(QDomDocument &doc, const QString &name, int content);
51 QDomElement textTag(QDomDocument &doc, const QString &name, bool content);
52 QDomElement textTag(QDomDocument &doc, const QString &name, QSize &s);
53 QDomElement textTag(QDomDocument &doc, const QString &name, QRect &r);
54 QDomElement stringListToXml(QDomDocument &doc, const QString &name, const QStringList &l);
55
56 void readEntry(const QDomElement &e, const QString &name, QString *v);
57 void readNumEntry(const QDomElement &e, const QString &name, int *v);
58 void readBoolEntry(const QDomElement &e, const QString &name, bool *v);
59 void readSizeEntry(const QDomElement &e, const QString &name, QSize *v);
60 void readRectEntry(const QDomElement &e, const QString &name, QRect *v);
61 void readColorEntry(const QDomElement &e, const QString &name, QColor *v);
62
63 void xmlToStringList(const QDomElement &e, const QString &name, QStringList *v);
64
65 void setBoolAttribute(QDomElement e, const QString &name, bool b);
66 void readBoolAttribute(QDomElement e, const QString &name, bool *v);
67
68 //QString tagContent(const QDomElement &e); // obsolete;
69};
70
71#endif
Note: See TracBrowser for help on using the repository browser.