Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members

FXHtmlParser.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                  HTML event generator object                                  *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2003 by Mathew Robertson.   All Rights Reserved.                *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (at your option) any later version.            *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************/
00022 #ifndef FXHTMLPARSER_H
00023 #define FXHTMLPARSER_H
00024 
00025 #ifndef FXXMLPARSER_H
00026 #include "FXXmlParser.h"
00027 #endif
00028 namespace FXEX {
00029 
00030 /**
00031  * This is a forst round implementation at generating a HTML parser which in turn
00032  * creates for events for each recognized HTML keyword.
00033  *
00034  * The purpose is to decouple the stream parsing from the storage in memory
00035  */
00036 class FXAPI FXHtmlParser : public FXXmlParser {
00037   FXDECLARE(FXHtmlParser)
00038 
00039 protected:
00040   /// for serialization
00041   FXHtmlParser() : FXXmlParser() {}
00042 
00043 public:
00044   enum {
00045     ID_HTML_PARSER=FXXmlParser::ID_LAST,
00046     ID_HTML,
00047     ID_HEAD,
00048     ID_BODY,
00049     ID_TITLE,
00050     ID_TEXT,
00051     ID_IMG,
00052     ID_HREF,
00053     ID_CENTER,
00054     ID_TABLE,
00055     ID_TR,
00056     ID_TD,
00057     ID_LAST
00058     };
00059 
00060 public:
00061   long onComment(FXObject*,FXSelector,void*);
00062   long onXmlTag(FXObject*,FXSelector,void*);
00063   long onMetaTag(FXObject*,FXSelector,void*);
00064   long onTagBegin(FXObject*,FXSelector,void*);
00065   long onTagEnd(FXObject*,FXSelector,void*);
00066   long onContent(FXObject*,FXSelector,void*);
00067   long onHtmlBegin(FXObject*,FXSelector,void*);
00068   long onHtmlEnd(FXObject*,FXSelector,void*);
00069 
00070 public:
00071   /// create a reader for the incoming stream
00072   FXHtmlParser(FXApp* a,FXStream* s,FXObject* tgt,FXSelector sel);
00073 
00074   /// cleanup
00075   virtual ~FXHtmlParser();
00076   };
00077 
00078 } // namespace FXEX
00079 #endif // FXHTMLPARSER_H