TDParser.h
Go to the documentation of this file.
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 TDPARSER_H_INCLUDED
00011 #define TDPARSER_H_INCLUDED
00012 
00013 #include <vector>
00014 
00015 #include "PDXParser.h"
00016 
00017 
00018 namespace libebook
00019 {
00020 
00021 class EBOOKCharsetConverter;
00022 
00023 class TDTextParser;
00024 
00025 class TDParser : public PDXParser
00026 {
00027   // disable copying
00028   TDParser(const TDParser &);
00029   TDParser &operator=(const TDParser &);
00030 
00031 public:
00032   explicit TDParser(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *document = 0);
00033   virtual ~TDParser();
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 
00048 private:
00049   bool m_compressed;
00050   unsigned m_textLength;
00051   unsigned m_recordCount;
00052   unsigned m_recordSize;
00053   unsigned m_read;
00054 
00055   bool m_openedDocument;
00056 
00057   EBOOKCharsetConverter *m_converter;
00058   TDTextParser *m_textParser;
00059 };
00060 
00061 }
00062 
00063 #endif // TDPARSER_H_INCLUDED
00064 
00065 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */