~ubuntu-branches/ubuntu/vivid/fbreader/vivid-proposed

« back to all changes in this revision

Viewing changes to fbreader/src/formats/xhtml/XHTMLReader.h

  • Committer: Bazaar Package Importer
  • Author(s): Joey Hess
  • Date: 2008-01-23 16:51:07 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080123165107-5q19etahzd72c33a
Tags: 0.8.12-3
* Add libzlui-maemo which allows using fbreader on the maemo platform, on
  Debian. Thanks, Riku Voipio. Closes: #462299
* makefiles/arch/maemo.mk: Don't build with -thumb. (Riku)
* Loosen dependency versions some more, so it only depends on the current
  upstream version or higher, ignoring the Debian revision.
* Use binary:Version instead of deprecated Source-Version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2004-2008 Geometer Plus <contact@geometerplus.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
 
17
 * 02110-1301, USA.
 
18
 */
 
19
 
 
20
#ifndef __XHTMLREADER_H__
 
21
#define __XHTMLREADER_H__
 
22
 
 
23
#include <string>
 
24
#include <map>
 
25
#include <stack>
 
26
 
 
27
#include <ZLXMLReader.h>
 
28
 
 
29
class BookReader;
 
30
class XHTMLReader;
 
31
 
 
32
class XHTMLTagAction {
 
33
 
 
34
public:
 
35
        virtual ~XHTMLTagAction();
 
36
        
 
37
        virtual void doAtStart(XHTMLReader &reader, const char **xmlattributes) = 0;
 
38
        virtual void doAtEnd(XHTMLReader &reader) = 0;
 
39
};
 
40
 
 
41
class XHTMLReader : public ZLXMLReader {
 
42
 
 
43
private:
 
44
        static std::map<std::string,XHTMLTagAction*> ourTagActions;
 
45
        static void addAction(const std::string &tag, XHTMLTagAction *action);
 
46
        static void fillTagTable();
 
47
 
 
48
public:
 
49
        XHTMLReader(BookReader &modelReader);
 
50
        bool readFile(const std::string &pathPrefix, const std::string &fileName, const std::string &referenceName);
 
51
 
 
52
        void startElementHandler(const char *tag, const char **attributes);
 
53
        void endElementHandler(const char *tag);
 
54
        void characterDataHandler(const char *text, int len);
 
55
 
 
56
        const std::vector<std::string> &externalDTDs() const;
 
57
 
 
58
private:
 
59
        BookReader &myModelReader;
 
60
        std::string myPathPrefix;
 
61
        std::string myReferenceName;
 
62
        bool myPreformatted;
 
63
 
 
64
        friend class XHTMLTagAction;
 
65
        friend class XHTMLTagParagraphAction;
 
66
        friend class XHTMLTagRestartParagraphAction;
 
67
        friend class XHTMLTagControlAction;
 
68
        friend class XHTMLTagHyperlinkAction;
 
69
        friend class XHTMLTagItemAction;
 
70
        friend class XHTMLTagImageAction;
 
71
        friend class XHTMLTagParagraphWithControlAction;
 
72
        friend class XHTMLTagPreAction;
 
73
};
 
74
 
 
75
#endif /* __XHTMLREADER_H__ */