1 /* 2 * Copyright (C) 2004-2010 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 __HHCREADER_H__ 21 #define __HHCREADER_H__ 22 23 #include <vector> 24 25 #include "../html/HtmlReader.h" 26 #include "../../bookmodel/BookModel.h" 27 #include "../../bookmodel/BookReader.h" 28 29 class CHMReferenceCollection; 30 31 class HHCReader : public HtmlReader { 32 33 public: 34 HHCReader(CHMReferenceCollection &collection, BookModel &model, const std::string &encoding); 35 ~HHCReader(); 36 37 void setReferences(); 38 39 private: 40 void startDocumentHandler(); 41 void endDocumentHandler(); 42 43 bool tagHandler(const HtmlTag &tag); 44 bool characterDataHandler(const char*, size_t, bool); 45 46 private: 47 CHMReferenceCollection &myReferenceCollection; 48 49 std::string myText; 50 std::string myReference; 51 52 BookReader myBookReader; 53 54 std::vector<std::string> myReferenceVector; 55 }; 56 57 #endif /* __HHCREADER_H__ */ 58