LRFParser.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3  * This file is part of the libe-book project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  */
9 
10 #ifndef LRFPARSER_H_INCLUDED
11 #define LRFPARSER_H_INCLUDED
12 
13 #include <map>
14 
15 #include "LRFCollector.h"
16 
17 
18 namespace libebook
19 {
20 
21 struct LRFHeader;
22 
23 class LRFParser
24 {
25  // disable copying
26  LRFParser(const LRFParser &other);
27  LRFParser &operator=(const LRFParser &other);
28 
30  {
58  };
59 
61  {
62  unsigned offset;
63  unsigned size;
64  bool reading;
65  bool read;
66  };
67 
68  typedef std::map<unsigned, LRFIndexEntry> ObjectIndex_t;
69 
70 public:
71  LRFParser(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *document);
72  ~LRFParser();
73 
74  bool parse();
75 
76  static bool isSupported(librevenge::RVNGInputStream *input);
77 
78 private:
79  void readHeader();
80  void readMetadata();
81  void readThumbnail();
82  void readObjectIndex();
83 
84  void readObject(unsigned id, unsigned type = OBJECT_TYPE_UNSPECIFIED);
85 
86  void readPageTreeObject(librevenge::RVNGInputStream *object);
87  void readPageObject(librevenge::RVNGInputStream *object);
88  void readFooterObject(librevenge::RVNGInputStream *object);
89  void readHeaderObject(librevenge::RVNGInputStream *object);
90  void readPageAtrObject(librevenge::RVNGInputStream *object, unsigned id);
91  void readBlockObject(librevenge::RVNGInputStream *object);
92  void readBlockAtrObject(librevenge::RVNGInputStream *object, unsigned id);
93  void readMiniPageObject(librevenge::RVNGInputStream *object);
94  void readBlockListObject(librevenge::RVNGInputStream *object);
95  void readTextObject(librevenge::RVNGInputStream *object);
96  void readTextAtrObject(librevenge::RVNGInputStream *object, unsigned id);
97  void readImageObject(librevenge::RVNGInputStream *object);
98  void readCanvasObject(librevenge::RVNGInputStream *object);
99  void readParagraphAtrObject(librevenge::RVNGInputStream *object, unsigned id);
100  void readImageStreamObject(librevenge::RVNGInputStream *object, unsigned id);
101  void readImportObject(librevenge::RVNGInputStream *object);
102  void readButtonObject(librevenge::RVNGInputStream *object);
103  void readWindowObject(librevenge::RVNGInputStream *object);
104  void readPopUpWinObject(librevenge::RVNGInputStream *object);
105  void readSoundObject(librevenge::RVNGInputStream *object);
106  void readPlaneStreamObject(librevenge::RVNGInputStream *object);
107  void readFontObject(librevenge::RVNGInputStream *object);
108  void readObjectInfoObject(librevenge::RVNGInputStream *object);
109  void readBookAtrObject(librevenge::RVNGInputStream *object);
110  void readSimpleTextObject(librevenge::RVNGInputStream *object);
111  void readTOCObject(librevenge::RVNGInputStream *object);
112 
113  bool readAttribute(unsigned tag, librevenge::RVNGInputStream *input, LRFAttributes &attributes);
114 
115  void skipUnhandledTag(unsigned tag, librevenge::RVNGInputStream *input, const char *objectType);
116 
117  bool isObjectRead(unsigned id) const;
118 
119 private:
121  librevenge::RVNGInputStream *m_input;
124  unsigned m_pageTree;
125 };
126 
127 } // namespace libebook
128 
129 #endif // LRFPARSER_H_INCLUDED
130 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
Definition: LRFParser.h:41
Definition: LRFTypes.h:75
LRFParser(const LRFParser &other)
Definition: EBOOKHTMLToken.h:91
void readObject(unsigned id, unsigned type=OBJECT_TYPE_UNSPECIFIED)
Definition: LRFParser.cpp:348
void readPageObject(librevenge::RVNGInputStream *object)
Definition: LRFParser.cpp:518
void readObjectIndex()
Definition: LRFParser.cpp:332
Definition: LRFParser.h:43
LRFParser & operator=(const LRFParser &other)
void readThumbnail()
Definition: LRFParser.cpp:327
ObjectType
Definition: LRFParser.h:29
bool parse()
Definition: LRFParser.cpp:261
void readObjectInfoObject(librevenge::RVNGInputStream *object)
Definition: LRFParser.cpp:1035
librevenge::RVNGInputStream * m_input
Definition: LRFParser.h:121
~LRFParser()
Definition: LRFParser.cpp:256
void readTextAtrObject(librevenge::RVNGInputStream *object, unsigned id)
Definition: LRFParser.cpp:852
void readBlockObject(librevenge::RVNGInputStream *object)
Definition: LRFParser.cpp:623
void readFooterObject(librevenge::RVNGInputStream *object)
Definition: LRFParser.cpp:595
Definition: LRFParser.h:57
Definition: LRFParser.h:47
void readHeader()
Definition: LRFParser.cpp:283
bool readAttribute(unsigned tag, librevenge::RVNGInputStream *input, LRFAttributes &attributes)
Definition: LRFParser.cpp:1085
EBOOKDocument::Type type
Definition: EBOOKDocument.cpp:317
std::map< unsigned, LRFIndexEntry > ObjectIndex_t
Definition: LRFParser.h:68
void readBlockAtrObject(librevenge::RVNGInputStream *object, unsigned id)
Definition: LRFParser.cpp:691
Definition: LRFCollector.h:22
bool isObjectRead(unsigned id) const
Definition: LRFParser.cpp:1397
void readBlockListObject(librevenge::RVNGInputStream *object)
Definition: LRFParser.cpp:712
Definition: LRFParser.h:51
void readParagraphAtrObject(librevenge::RVNGInputStream *object, unsigned id)
Definition: LRFParser.cpp:917
void readHeaderObject(librevenge::RVNGInputStream *object)
Definition: LRFParser.cpp:602
void readButtonObject(librevenge::RVNGInputStream *object)
Definition: LRFParser.cpp:993
Definition: LRFParser.h:48
bool read
Definition: LRFParser.h:65
LRFCollector m_collector
Definition: LRFParser.h:120
unsigned m_pageTree
Definition: LRFParser.h:124
void readTextObject(librevenge::RVNGInputStream *object)
Definition: LRFParser.cpp:719
Definition: LRFParser.h:34
void readSimpleTextObject(librevenge::RVNGInputStream *object)
Definition: LRFParser.cpp:1071
void readSoundObject(librevenge::RVNGInputStream *object)
Definition: LRFParser.cpp:1014
Definition: LRFParser.h:37
bool reading
Definition: LRFParser.h:64
void readMetadata()
Definition: LRFParser.cpp:314
Definition: LRFParser.h:53
void readCanvasObject(librevenge::RVNGInputStream *object)
Definition: LRFParser.cpp:910
void readWindowObject(librevenge::RVNGInputStream *object)
Definition: LRFParser.cpp:1000
Definition: LRFParser.h:49
ObjectIndex_t m_objectIndex
Definition: LRFParser.h:123
void readMiniPageObject(librevenge::RVNGInputStream *object)
Definition: LRFParser.cpp:705
unsigned size
Definition: LRFParser.h:63
Definition: LRFParser.h:35
XMLTreeNodePtr_t document
Definition: EBOOKHTMLParser.cpp:169
void readPopUpWinObject(librevenge::RVNGInputStream *object)
Definition: LRFParser.cpp:1007
Definition: LRFParser.h:44
void readPlaneStreamObject(librevenge::RVNGInputStream *object)
Definition: LRFParser.cpp:1021
void readPageTreeObject(librevenge::RVNGInputStream *object)
Definition: LRFParser.cpp:500
static bool isSupported(librevenge::RVNGInputStream *input)
Definition: LRFParser.cpp:275
void readTOCObject(librevenge::RVNGInputStream *object)
Definition: LRFParser.cpp:1078
LRFHeader * m_header
Definition: LRFParser.h:122
Definition: LRFParser.h:23
Definition: LRFParser.cpp:219
void skipUnhandledTag(unsigned tag, librevenge::RVNGInputStream *input, const char *objectType)
Definition: LRFParser.cpp:1181
void readPageAtrObject(librevenge::RVNGInputStream *object, unsigned id)
Definition: LRFParser.cpp:609
void readBookAtrObject(librevenge::RVNGInputStream *object)
Definition: LRFParser.cpp:1042
void readImportObject(librevenge::RVNGInputStream *object)
Definition: LRFParser.cpp:986
void readFontObject(librevenge::RVNGInputStream *object)
Definition: LRFParser.cpp:1028
unsigned offset
Definition: LRFParser.h:62
Definition: LRFParser.h:60
void readImageStreamObject(librevenge::RVNGInputStream *object, unsigned id)
Definition: LRFParser.cpp:931
Definition: LRFParser.h:33
void readImageObject(librevenge::RVNGInputStream *object)
Definition: LRFParser.cpp:866

Generated for libe-book by doxygen 1.8.5