Replace wxList used in wxHtmlPrintout with wxVector<> too
Prefer the use of the standard-like template class to macro-based list. It also makes more sense to use a vector rather than a linked list here, as the elements are never removed from or inserted into m_Filters, so there is no reason to prefer the list structure.
This commit is contained in:
@@ -200,7 +200,7 @@ private:
|
|||||||
float m_MarginTop, m_MarginBottom, m_MarginLeft, m_MarginRight, m_MarginSpace;
|
float m_MarginTop, m_MarginBottom, m_MarginLeft, m_MarginRight, m_MarginSpace;
|
||||||
|
|
||||||
// list of HTML filters
|
// list of HTML filters
|
||||||
static wxList m_Filters;
|
static wxVector<wxHtmlFilter*> m_Filters;
|
||||||
|
|
||||||
wxDECLARE_NO_COPY_CLASS(wxHtmlPrintout);
|
wxDECLARE_NO_COPY_CLASS(wxHtmlPrintout);
|
||||||
};
|
};
|
||||||
|
@@ -195,7 +195,7 @@ int wxHtmlDCRenderer::GetTotalHeight() const
|
|||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
wxList wxHtmlPrintout::m_Filters;
|
wxVector<wxHtmlFilter*> wxHtmlPrintout::m_Filters;
|
||||||
|
|
||||||
wxHtmlPrintout::wxHtmlPrintout(const wxString& title) : wxPrintout(title)
|
wxHtmlPrintout::wxHtmlPrintout(const wxString& title) : wxPrintout(title)
|
||||||
{
|
{
|
||||||
@@ -210,13 +210,16 @@ wxHtmlPrintout::wxHtmlPrintout(const wxString& title) : wxPrintout(title)
|
|||||||
|
|
||||||
void wxHtmlPrintout::CleanUpStatics()
|
void wxHtmlPrintout::CleanUpStatics()
|
||||||
{
|
{
|
||||||
WX_CLEAR_LIST(wxList, m_Filters);
|
for ( size_t n = 0; n < m_Filters.size(); ++n )
|
||||||
|
delete m_Filters[n];
|
||||||
|
|
||||||
|
m_Filters.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adds input filter
|
// Adds input filter
|
||||||
void wxHtmlPrintout::AddFilter(wxHtmlFilter *filter)
|
void wxHtmlPrintout::AddFilter(wxHtmlFilter *filter)
|
||||||
{
|
{
|
||||||
m_Filters.Append(filter);
|
m_Filters.push_back(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@@ -432,17 +435,15 @@ void wxHtmlPrintout::SetHtmlFile(const wxString& htmlfile)
|
|||||||
wxHtmlFilterHTML defaultFilter;
|
wxHtmlFilterHTML defaultFilter;
|
||||||
wxString doc;
|
wxString doc;
|
||||||
|
|
||||||
wxList::compatibility_iterator node = m_Filters.GetFirst();
|
for ( size_t n = 0; n < m_Filters.size(); ++n )
|
||||||
while (node)
|
|
||||||
{
|
{
|
||||||
wxHtmlFilter *h = (wxHtmlFilter*) node->GetData();
|
wxHtmlFilter* const h = m_Filters[n];
|
||||||
if (h->CanRead(*ff))
|
if (h->CanRead(*ff))
|
||||||
{
|
{
|
||||||
doc = h->ReadFile(*ff);
|
doc = h->ReadFile(*ff);
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
node = node->GetNext();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!done)
|
if (!done)
|
||||||
|
Reference in New Issue
Block a user