X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5bddd46dde044ccb04952e027b4ec27bb1251bba..92c0fc34c104c8d7c12d6a3b78ea232690fc23f4:/interface/wx/html/htmlpars.h diff --git a/interface/wx/html/htmlpars.h b/interface/wx/html/htmlpars.h index dc97e2f6bf..d5359ec8c1 100644 --- a/interface/wx/html/htmlpars.h +++ b/interface/wx/html/htmlpars.h @@ -2,10 +2,18 @@ // Name: html/htmlpars.h // Purpose: interface of wxHtmlTagHandler // Author: wxWidgets team -// RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +enum wxHtmlURLType +{ + wxHTML_URL_PAGE, + wxHTML_URL_IMAGE, + wxHTML_URL_OTHER +}; + + + /** @class wxHtmlTagHandler @@ -55,6 +63,22 @@ public: */ virtual bool HandleTag(const wxHtmlTag& tag) = 0; + /** + Assigns @a parser to this handler. Each @b instance of handler + is guaranteed to be called only from the one parser. + */ + virtual void SetParser(wxHtmlParser* parser); + + /** + Returns the parser associated with this tag handler. + + @since 2.9.5 + */ + wxHtmlParser* GetParser() const; + + +protected: + /** This method calls parser's wxHtmlParser::DoParsing method for the string between this tag and the paired ending tag: @@ -68,12 +92,13 @@ public: void ParseInner(const wxHtmlTag& tag); /** - Assigns @a parser to this handler. Each @b instance of handler - is guaranteed to be called only from the parser. + Parses given source as if it was tag's inner code (see + wxHtmlParser::GetInnerSource). Unlike ParseInner(), this method lets + you specify the source code to parse. This is useful when you need to + modify the inner text before parsing. */ - virtual void SetParser(wxHtmlParser parser); + void ParseInnerSource(const wxString& source); -protected: /** This attribute is used to access parent parser. It is protected so that it can't be accessed by user but can be accessed from derived classes. @@ -113,17 +138,6 @@ public: */ wxHtmlParser(); - /** - This may (and may not) be overwritten in derived class. - - This method is called each time new tag is about to be added. - @a tag contains information about the tag. (See wxHtmlTag for details.) - - Default (wxHtmlParser) behaviour is this: first it finds a handler capable - of handling this tag and then it calls handler's HandleTag() method. - */ - virtual void AddTag(const wxHtmlTag& tag); - /** Adds handler to the internal list ( hash table) of handlers. This method should not be called directly by user but rather by derived class' @@ -135,7 +149,7 @@ public: All handlers are deleted on object deletion. */ - virtual void AddTagHandler(wxHtmlTagHandler handler); + virtual void AddTagHandler(wxHtmlTagHandler* handler); /** Must be overwritten in derived class. @@ -149,7 +163,7 @@ public: /** Parses the m_Source from @a begin_pos to @a end_pos - 1. */ - void DoParsing(int begin_pos, int end_pos); + void DoParsing(const const_iterator& begin_pos, const const_iterator& end_pos); /** Parses the whole m_Source. @@ -184,7 +198,7 @@ public: /** Returns pointer to the source being parsed. */ - wxString* GetSource(); + const wxString* GetSource(); /** Setups the parser for parsing the @a source string. @@ -217,8 +231,7 @@ public: Returned wxFSFile object is not guaranteed to point to url, it might have been redirected! */ - virtual wxFSFile* OpenURL(wxHtmlURLType type, - const wxString& url); + virtual wxFSFile* OpenURL(wxHtmlURLType type, const wxString& url) const; /** Proceeds parsing of the document. This is end-user method. You can simply @@ -292,7 +305,7 @@ public: Sets the virtual file system that will be used to request additional files. (For example @c IMG tag handler requests wxFSFile with the image data.) */ - void SetFS(wxFileSystem fs); + void SetFS(wxFileSystem* fs); /** Call this function to interrupt parsing from a tag handler. @@ -300,5 +313,18 @@ public: from Parse() or any function called by it (i.e. from tag handlers). */ virtual void StopParsing(); + +protected: + + /** + This may (and may not) be overwritten in derived class. + + This method is called each time new tag is about to be added. + @a tag contains information about the tag. (See wxHtmlTag for details.) + + Default (wxHtmlParser) behaviour is this: first it finds a handler capable + of handling this tag and then it calls handler's HandleTag() method. + */ + virtual void AddTag(const wxHtmlTag& tag); };