Added libxi-dev dependency
[froff-onlinedoc] / googlecontenthandler.h
1 /*
2  *  Copyright (c) 2010 Mani Chandrasekar <maninc@gmail.com>
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18
19 #ifndef GOOGLECONTENTHANDLER_H
20 #define GOOGLECONTENTHANDLER_H
21
22 #include <QXmlContentHandler>
23 #include <QStack>
24
25 class GoogleDocumentList;
26 class GoogleDocument;
27
28 class GoogleContentHandler : public QXmlContentHandler
29 {
30 public:
31     GoogleContentHandler();
32
33     virtual bool characters(const QString & ch);
34     virtual bool endDocument();
35     virtual bool endElement(const QString & namespaceURI, const QString & localName, const QString & qName);
36     virtual bool endPrefixMapping(const QString & prefix);
37     virtual QString errorString() const;
38     virtual bool ignorableWhitespace(const QString & ch);
39     virtual bool processingInstruction(const QString & target, const QString & data);
40     virtual void setDocumentLocator(QXmlLocator * locator);
41     virtual bool skippedEntity(const QString & name);
42     virtual bool startDocument();
43     virtual bool startElement(const QString & namespaceURI, const QString & localName, const QString & qName, const QXmlAttributes & atts);
44     virtual bool startPrefixMapping(const QString & prefix, const QString & uri);
45
46     GoogleDocumentList *documentList() {
47         return m_docList;
48     }
49
50 private:
51     QStack<QString> m_nodeStack;
52     bool insideEntry;
53     GoogleDocumentList *m_docList;
54     GoogleDocument *m_docEntry;
55
56     void printName(const QString & name);
57 };
58
59 #endif // GOOGLECONTENTHANDLER_H