Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

striphtml.h

Go to the documentation of this file.
00001 #ifndef __STRIPHTML_H
00002 #define __STRIPHTML_H
00003 
00004 #include "CFilter.h"
00005 #include "Navigation.h"
00006 #include "CBuffer.h"
00007 #include "CExpander.h"
00008 #include "my_list.h"
00009 
00010 class striphtml : public CFilter
00011 {
00012   void reset();
00013   bool ignorespace;
00014   bool m_bchm;
00015   int tablenesteddepth;
00016    CList<CStyle> stylestack;
00017   static CNavigation_base<htmlmark> m_nav;
00018   QMap<QString, tchar>* entmap;
00019     CStyle currentstyle;
00020     bool isPre;
00021     unsigned short skip_ws();
00022     unsigned short skip_ws_end();
00023     unsigned short skip_ws_end(unsigned long&);
00024     unsigned short parse_m();
00025     QMap<QString, unsigned long>* href2filepos;
00026     QMap<unsigned long, QString>* id2href;
00027     unsigned long currentid;
00028     tchar lastch;
00029     QString currentfile;
00030     QString q;
00031     bool forcecentre, m_inblock;
00032     QString text_q;
00033     int indent;
00034     int m_listtype[m_cmaxdepth];
00035     int m_ctr[m_cmaxdepth];
00036     void mygetch(tchar& ch, CStyle& sty, unsigned long& pos);
00037     void initentmap();
00038     QString getname(tchar& ch, const QString& nd);
00039     void skipblock(const QString&);
00040     QString getattr(tchar&);
00041     QString dehtml(const QString& _info);
00042     void parse_paragraph(CStyle& currentstyle, tchar& ch, unsigned long);
00043     int getpara(CBuffer&, unsigned long&);
00044  public:
00045     QString about() { return QString("HTML filter (c) Tim Wentford\n")+parent->about(); }
00046     striphtml(const QString&);
00047     ~striphtml();
00048     void getch(tchar& ch, CStyle& sty, unsigned long& pos);
00049     virtual linkType hyperlink(unsigned int n, unsigned int noff, QString& w, QString& nm);
00050     bool findanchor(const QString&);
00051 
00052 
00053     void saveposn(const QString& f, size_t posn) { m_nav.saveposn(htmlmark(f, posn)); }
00054     void writeposn(const QString& f, size_t posn) { m_nav.writeposn(htmlmark(f, posn)); }
00055     linkType forward(QString& f, size_t& loc)
00056       {
00057         htmlmark m(f, loc);
00058         linkType ret =  (m_nav.forward(m)) ? eFile : eNone;
00059         if (f == m.filename())
00060           {
00061             if (ret == eFile)
00062               {
00063                 ret = eLink;
00064               }
00065           }
00066         else
00067           {
00068             f = m.filename();
00069           }
00070         loc = m.posn();
00071         return ret;
00072       }
00073     linkType back(QString& f, size_t& loc)
00074       {
00075         htmlmark m(f, loc);
00076         linkType ret =  (m_nav.back(m)) ? eFile : eNone;
00077         if (f == m.filename())
00078           {
00079             if (ret == eFile)
00080               {
00081                 ret = eLink;
00082               }
00083           }
00084         else
00085           {
00086             f = m.filename();
00087           }
00088         loc = m.posn();
00089         return ret;
00090       }
00091     bool hasnavigation() { return true; }
00092     virtual void locate(unsigned int n);
00093     void setchm(bool _b) { m_bchm = _b; }
00094     QString getTableAsHtml(unsigned long loc);
00095 };
00096 #endif

Generated on Sat Nov 5 16:16:59 2005 for OPIE by  doxygen 1.4.2