summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_xmlcommon.h
blob: f6a94e597497ebb06763e4b5cf69d2f55a9779cc (plain)
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<tqdom.h>

class TQDateTime;
class TQRect;
class TQSize;
class TQColor;
class TQStringList;

bool stamp2TS(const TQString &ts, TQDateTime *d);
TQString TS2stamp(const TQDateTime &d);
TQDomElement textTag(TQDomDocument *doc, const TQString &name, const TQString &content);
TQString tagContent(const TQDomElement &e);
TQDomElement findSubTag(const TQDomElement &e, const TQString &name, bool *found);
TQDomElement createIQ(TQDomDocument *doc, const TQString &type, const TQString &to, const TQString &id);
TQDomElement queryTag(const TQDomElement &e);
TQString queryNS(const TQDomElement &e);
void getErrorFromElement(const TQDomElement &e, int *code, TQString *str);

namespace XMLHelper {
	//TQDomElement findSubTag(const TQDomElement &e, const TQString &name, bool *found);
	bool hasSubTag(const TQDomElement &e, const TQString &name);

	TQDomElement emptyTag(TQDomDocument *doc, const TQString &name);
	TQString subTagText(const TQDomElement &e, const TQString &name);

	TQDomElement textTag(TQDomDocument &doc, const TQString &name, const TQString &content);
	TQDomElement textTag(TQDomDocument &doc, const TQString &name, int content);
	TQDomElement textTag(TQDomDocument &doc, const TQString &name, bool content);
	TQDomElement textTag(TQDomDocument &doc, const TQString &name, TQSize &s);
	TQDomElement textTag(TQDomDocument &doc, const TQString &name, TQRect &r);
	TQDomElement stringListToXml(TQDomDocument &doc, const TQString &name, const TQStringList &l);

	void readEntry(const TQDomElement &e, const TQString &name, TQString *v);
	void readNumEntry(const TQDomElement &e, const TQString &name, int *v);
	void readBoolEntry(const TQDomElement &e, const TQString &name, bool *v);
	void readSizeEntry(const TQDomElement &e, const TQString &name, TQSize *v);
	void readRectEntry(const TQDomElement &e, const TQString &name, TQRect *v);
	void readColorEntry(const TQDomElement &e, const TQString &name, TQColor *v);

	void xmlToStringList(const TQDomElement &e, const TQString &name, TQStringList *v);

	void setBoolAttribute(TQDomElement e, const TQString &name, bool b);
	void readBoolAttribute(TQDomElement e, const TQString &name, bool *v);

	//TQString tagContent(const TQDomElement &e); // obsolete;
}

#endif