00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ 00002 00003 /* AbiWord: tidyReader - plugin for Multipart [X]HTML 00004 * 00005 * Copyright (C) 2002 Francis James Franklin <fjf@alinameridon.com> 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation; either version 2 00010 * of the License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00020 * 02110-1301 USA. 00021 */ 00022 00023 00024 #ifndef TIDYREADER_H 00025 #define TIDYREADER_H 00026 00027 #include <tidy/tidy.h> 00028 #include <tidy/buffio.h> 00029 00030 #include "ut_xml.h" 00031 00032 class TidyReader : public UT_XML::Reader 00033 { 00034 public: 00035 TidyReader (); 00036 TidyReader (const UT_Byte * buffer, UT_uint32 length); 00037 00038 virtual ~TidyReader (); 00039 00040 virtual bool openFile (const char * szFilename); 00041 virtual UT_uint32 readBytes (char * buffer, UT_uint32 length); 00042 virtual void closeFile (void); 00043 00044 private: 00045 const UT_Byte * const m_buffer; 00046 const UT_uint32 m_length; 00047 00048 TidyDoc m_tidy; 00049 00050 TidyBuffer m_outbuf; 00051 TidyBuffer m_errbuf; 00052 }; 00053 00054 #endif