// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "htmlpars.h"
-#endif
-
#include "wx/wxprec.h"
#include "wx/defs.h"
};
WX_DECLARE_OBJARRAY(wxHtmlTextPiece, wxHtmlTextPieces);
-WX_DEFINE_OBJARRAY(wxHtmlTextPieces);
+WX_DEFINE_OBJARRAY(wxHtmlTextPieces)
class wxHtmlParserState
{
}
else if (m_CurTag)
{
- // Add tag:
- if (m_CurTag)
- {
- if (m_CurTag->HasEnding())
- begin_pos = m_CurTag->GetEndPos2();
- else
- begin_pos = m_CurTag->GetBeginPos();
- }
+ if (m_CurTag->HasEnding())
+ begin_pos = m_CurTag->GetEndPos2();
+ else
+ begin_pos = m_CurTag->GetBeginPos();
wxHtmlTag *t = m_CurTag;
m_CurTag = m_CurTag->GetNextTag();
AddTag(*t);
handler->SetParser(this);
}
-void wxHtmlParser::PushTagHandler(wxHtmlTagHandler *handler, wxString tags)
+void wxHtmlParser::PushTagHandler(wxHtmlTagHandler *handler, const wxString& tags)
{
wxStringTokenizer tokenizer(tags, wxT(", "));
wxString key;
{
if (c - last > 0)
output.append(last, c - last);
- if (++c == wxT('\0')) break;
+ if ( *++c == wxT('\0') )
+ break;
wxString entity;
const wxChar *ent_s = c;
while (substitutions[substitutions_cnt].code != 0)
substitutions_cnt++;
- wxHtmlEntityInfo *info;
+ wxHtmlEntityInfo *info = NULL;
+#ifdef __WXWINCE__
+ // bsearch crashes under WinCE for some reason
+ size_t i;
+ for (i = 0; i < substitutions_cnt; i++)
+ {
+ if (entity == substitutions[i].name)
+ {
+ info = & substitutions[i];
+ break;
+ }
+ }
+#else
info = (wxHtmlEntityInfo*) bsearch(entity.c_str(), substitutions,
substitutions_cnt,
sizeof(wxHtmlEntityInfo),
wxHtmlEntityCompare);
+#endif
if (info)
code = info->code;
}
wxString wxHtmlParser::ExtractCharsetInformation(const wxString& markup)
{
wxString charset;
- wxMetaTagParser parser;
- parser.AddTagHandler(new wxMetaTagHandler(&charset));
- parser.Parse(markup);
+ wxMetaTagParser *parser = new wxMetaTagParser();
+ if(parser)
+ {
+ parser->AddTagHandler(new wxMetaTagHandler(&charset));
+ parser->Parse(markup);
+ delete parser;
+ }
return charset;
}