00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 00002 /* 00003 * This file is part of the libe-book project. 00004 * 00005 * This Source Code Form is subject to the terms of the Mozilla Public 00006 * License, v. 2.0. If a copy of the MPL was not distributed with this 00007 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 00008 */ 00009 00010 #ifndef PDBPARSER_H_INCLUDED 00011 #define PDBPARSER_H_INCLUDED 00012 00013 #include <vector> 00014 00015 #include <librevenge/librevenge.h> 00016 00017 #include "PDXParser.h" 00018 00019 00020 namespace libebook 00021 { 00022 00023 class EBOOKCharsetConverter; 00024 00025 class PDBParser : public PDXParser 00026 { 00027 // disable copying 00028 PDBParser(const PDBParser &); 00029 PDBParser &operator=(const PDBParser &); 00030 00031 public: 00032 explicit PDBParser(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *document = 0); 00033 virtual ~PDBParser(); 00034 00035 static bool checkType(unsigned type, unsigned creator); 00036 00037 private: 00038 virtual void readAppInfoRecord(librevenge::RVNGInputStream *record); 00039 virtual void readSortInfoRecord(librevenge::RVNGInputStream *record); 00040 virtual void readIndexRecord(librevenge::RVNGInputStream *record); 00041 virtual void readDataRecord(librevenge::RVNGInputStream *record, bool last); 00042 00043 void createConverter(const std::vector<char> &text); 00044 00045 void openDocument(); 00046 void closeDocument(); 00047 void handleText(const std::vector<char> &text); 00048 void openParagraph(); 00049 void closeParagraph(bool continuing = false); 00050 void handleCharacters(const char *text); 00051 00052 private: 00053 bool m_compressed; 00054 unsigned m_textLength; 00055 unsigned m_recordCount; 00056 unsigned m_recordSize; 00057 unsigned m_read; 00058 00068 bool m_openedParagraph; 00069 bool m_openedDocument; 00070 00071 EBOOKCharsetConverter *m_converter; 00072 }; 00073 00074 } 00075 00076 #endif // PDBPARSER_H_INCLUDED 00077 00078 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */