X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/69941f05864fa8b37856ccc1338124bfac756a2b..22e0ea84c89c61cceb3deb2b62145afa047a0dff:/include/wx/html/htmlpars.h
diff --git a/include/wx/html/htmlpars.h b/include/wx/html/htmlpars.h
index bc098ba42b..77e091e5a3 100644
--- a/include/wx/html/htmlpars.h
+++ b/include/wx/html/htmlpars.h
@@ -37,7 +37,7 @@ class WXDLLEXPORT wxHtmlParser : public wxObject
DECLARE_ABSTRACT_CLASS(wxHtmlParser)
public:
- wxHtmlParser() : wxObject(), m_HandlersHash(wxKEY_STRING) {m_FS = NULL; m_Cache = NULL;}
+ wxHtmlParser() : wxObject(), m_HandlersHash(wxKEY_STRING) {m_FS = NULL; m_Cache = NULL; m_HandlersStack = NULL;}
virtual ~wxHtmlParser();
void SetFS(wxFileSystem *fs) {m_FS = fs;}
@@ -70,18 +70,25 @@ class WXDLLEXPORT wxHtmlParser : public wxObject
virtual void AddTagHandler(wxHtmlTagHandler *handler);
// adds handler to the list & hash table of handlers.
+
+ void PushTagHandler(wxHtmlTagHandler *handler, wxString tags);
+ // Forces the handler to handle additional tags (not returned by GetSupportedTags).
+ // The handler should already be in use by this parser.
+ // Example: you want to parse following pseudo-html structure:
+ //
+ //
+ //
+ //
+ // This last it has different meaning, we don't want it to be parsed by myitems handler!
+ // handler can handle only 'myitems' (e.g. it's GetSupportedTags returns "MYITEMS")
+ // you can call PushTagHandler(handler, "IT") when you find
+ // and call PopTagHandler() when you find
+
+ void PopTagHandler();
+ // Restores state before last call to PushTagHandler
wxString* GetSource() {return &m_Source;}
- virtual wxList* GetTempData() {return NULL;}
- // this method returns list of wxObjects that represents
- // all data allocated by the parser. These can't be freeded
- // by destructor because they must be valid as long as
- // GetProduct's return value is valid - the caller must
- // explicitly call delete MyParser -> GetTempData() to free
- // the memory
- // (this method always sets the list to delete its contents)
-
protected:
virtual void AddText(const char* txt) = 0;
@@ -117,6 +124,8 @@ class WXDLLEXPORT wxHtmlParser : public wxObject
// only one reference to each handler instance.
wxFileSystem *m_FS;
// class for opening files (file system)
+ wxList *m_HandlersStack;
+ // handlers stack used by PushTagHandler and PopTagHandler
};
@@ -165,7 +174,7 @@ class WXDLLEXPORT wxHtmlTagHandler : public wxObject
// FALSE etherwise
protected:
- void ParseInner(const wxHtmlTag& tag) {m_Parser -> DoParsing(tag.GetBeginPos(), tag.GetEndPos1());}
+ void ParseInner(const wxHtmlTag& tag) {m_Parser->DoParsing(tag.GetBeginPos(), tag.GetEndPos1());}
// parses input between beginning and ending tag.
// m_Parser must be set.
};