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

« back to all changes in this revision

Viewing changes to iris/src/xmpp/xmpp-core/parser.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
 * parser.h - parse an XMPP "document"
 
3
 * Copyright (C) 2003  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 PARSER_H
 
22
#define PARSER_H
 
23
 
 
24
#include <qdom.h>
 
25
#include <qxml.h>
 
26
 
 
27
namespace XMPP
 
28
{
 
29
        class Parser
 
30
        {
 
31
        public:
 
32
                Parser();
 
33
                ~Parser();
 
34
 
 
35
                class Event
 
36
                {
 
37
                public:
 
38
                        enum Type { DocumentOpen, DocumentClose, Element, Error };
 
39
                        Event();
 
40
                        Event(const Event &);
 
41
                        Event & operator=(const Event &);
 
42
                        ~Event();
 
43
 
 
44
                        bool isNull() const;
 
45
                        int type() const;
 
46
 
 
47
                        // for document open
 
48
                        QString nsprefix(const QString &s=QString::null) const;
 
49
 
 
50
                        // for document open / close
 
51
                        QString namespaceURI() const;
 
52
                        QString localName() const;
 
53
                        QString qName() const;
 
54
                        QXmlAttributes atts() const;
 
55
 
 
56
                        // for element
 
57
                        QDomElement element() const;
 
58
 
 
59
                        // for any
 
60
                        QString actualString() const;
 
61
 
 
62
                        // setup
 
63
                        void setDocumentOpen(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts, const QStringList &nsnames, const QStringList &nsvalues);
 
64
                        void setDocumentClose(const QString &namespaceURI, const QString &localName, const QString &qName);
 
65
                        void setElement(const QDomElement &elem);
 
66
                        void setError();
 
67
                        void setActualString(const QString &);
 
68
 
 
69
                private:
 
70
                        class Private;
 
71
                        Private *d;
 
72
                };
 
73
 
 
74
                void reset();
 
75
                void appendData(const QByteArray &a);
 
76
                Event readNext();
 
77
                QByteArray unprocessed() const;
 
78
                QString encoding() const;
 
79
 
 
80
        private:
 
81
                class Private;
 
82
                Private *d;
 
83
        };
 
84
}
 
85
 
 
86
#endif