Use wxString::empty() instead of comparison to wxEmptyString

This commit is contained in:
Paul Cornett
2017-05-29 00:05:52 -07:00
parent d16afbd3c1
commit c1f2bbce5d
10 changed files with 29 additions and 29 deletions

View File

@@ -936,7 +936,7 @@ bool wxGenericDirCtrl::ExpandPath(const wxString& path)
{ {
data = GetItemData(childId); data = GetItemData(childId);
if (data && data->m_path != wxEmptyString && !data->m_isDir) if (data && !data->m_path.empty() && !data->m_isDir)
{ {
m_treeCtrl->SelectItem(childId); m_treeCtrl->SelectItem(childId);
m_treeCtrl->EnsureVisible(childId); m_treeCtrl->EnsureVisible(childId);

View File

@@ -6359,7 +6359,7 @@ void wxGrid::ShowCellEditControl()
// resize editor to overflow into righthand cells if allowed // resize editor to overflow into righthand cells if allowed
int maxWidth = rect.width; int maxWidth = rect.width;
wxString value = GetCellValue(row, col); wxString value = GetCellValue(row, col);
if ( (value != wxEmptyString) && (attr->GetOverflow()) ) if ( !value.empty() && attr->GetOverflow() )
{ {
int y; int y;
GetTextExtent(value, &maxWidth, &y, NULL, NULL, &attr->GetFont()); GetTextExtent(value, &maxWidth, &y, NULL, NULL, &attr->GetFont());

View File

@@ -164,7 +164,7 @@ wxString wxFileTipProvider::GetTip()
// Break if tip isn't a comment, and isn't an empty string // Break if tip isn't a comment, and isn't an empty string
// (or only stray space characters). // (or only stray space characters).
if ( !tip.StartsWith(wxT("#")) && (tip.Trim() != wxEmptyString) ) if ( !tip.StartsWith(wxT("#")) && !tip.Trim().empty() )
{ {
break; break;
} }

View File

@@ -700,7 +700,7 @@ bool wxHtmlHelpData::AddBook(const wxString& book)
wxFontEncoding enc = wxFONTENCODING_SYSTEM; wxFontEncoding enc = wxFONTENCODING_SYSTEM;
#if wxUSE_FONTMAP #if wxUSE_FONTMAP
if (charset != wxEmptyString) if (!charset.empty())
enc = wxFontMapper::Get()->CharsetToEncoding(charset); enc = wxFontMapper::Get()->CharsetToEncoding(charset);
#endif #endif
@@ -807,7 +807,7 @@ wxHtmlSearchStatus::wxHtmlSearchStatus(wxHtmlHelpData* data, const wxString& key
m_Data = data; m_Data = data;
m_Keyword = keyword; m_Keyword = keyword;
wxHtmlBookRecord* bookr = NULL; wxHtmlBookRecord* bookr = NULL;
if (book != wxEmptyString) if (!book.empty())
{ {
// we have to search in a specific book. Find it first // we have to search in a specific book. Find it first
int i, cnt = data->m_bookRecords.GetCount(); int i, cnt = data->m_bookRecords.GetCount();

View File

@@ -1073,7 +1073,7 @@ void wxHtmlHelpWindow::ReadCustomization(wxConfigBase *cfg, const wxString& path
wxString oldpath; wxString oldpath;
wxString tmp; wxString tmp;
if (path != wxEmptyString) if (!path.empty())
{ {
oldpath = cfg->GetPath(); oldpath = cfg->GetPath();
cfg->SetPath(wxT("/") + path); cfg->SetPath(wxT("/") + path);
@@ -1122,7 +1122,7 @@ void wxHtmlHelpWindow::ReadCustomization(wxConfigBase *cfg, const wxString& path
if (m_HtmlWin) if (m_HtmlWin)
m_HtmlWin->ReadCustomization(cfg); m_HtmlWin->ReadCustomization(cfg);
if (path != wxEmptyString) if (!path.empty())
cfg->SetPath(oldpath); cfg->SetPath(oldpath);
} }
@@ -1131,7 +1131,7 @@ void wxHtmlHelpWindow::WriteCustomization(wxConfigBase *cfg, const wxString& pat
wxString oldpath; wxString oldpath;
wxString tmp; wxString tmp;
if (path != wxEmptyString) if (!path.empty())
{ {
oldpath = cfg->GetPath(); oldpath = cfg->GetPath();
cfg->SetPath(wxT("/") + path); cfg->SetPath(wxT("/") + path);
@@ -1170,7 +1170,7 @@ void wxHtmlHelpWindow::WriteCustomization(wxConfigBase *cfg, const wxString& pat
if (m_HtmlWin) if (m_HtmlWin)
m_HtmlWin->WriteCustomization(cfg); m_HtmlWin->WriteCustomization(cfg);
if (path != wxEmptyString) if (!path.empty())
cfg->SetPath(oldpath); cfg->SetPath(oldpath);
} }
#endif // wxUSE_CONFIG #endif // wxUSE_CONFIG
@@ -1495,7 +1495,7 @@ void wxHtmlHelpWindow::OnToolbar(wxCommandEvent& event)
item = m_HtmlWin->GetOpenedPageTitle(); item = m_HtmlWin->GetOpenedPageTitle();
url = m_HtmlWin->GetOpenedPage(); url = m_HtmlWin->GetOpenedPage();
if (item == wxEmptyString) if (item.empty())
item = url.AfterLast(wxT('/')); item = url.AfterLast(wxT('/'));
if (m_BookmarksPages.Index(url) == wxNOT_FOUND) if (m_BookmarksPages.Index(url) == wxNOT_FOUND)
{ {
@@ -1612,7 +1612,7 @@ void wxHtmlHelpWindow::DoIndexFind()
{ {
wxString sr = m_IndexText->GetLineText(0); wxString sr = m_IndexText->GetLineText(0);
sr.MakeLower(); sr.MakeLower();
if (sr == wxEmptyString) if (sr.empty())
{ {
DoIndexAll(); DoIndexAll();
} }

View File

@@ -179,7 +179,7 @@ wxHtmlCell::AdjustPagebreak(int *pagebreak,
void wxHtmlCell::SetLink(const wxHtmlLinkInfo& link) void wxHtmlCell::SetLink(const wxHtmlLinkInfo& link)
{ {
wxDELETE(m_Link); wxDELETE(m_Link);
if (link.GetHref() != wxEmptyString) if (!link.GetHref().empty())
m_Link = new wxHtmlLinkInfo(link); m_Link = new wxHtmlLinkInfo(link);
} }

View File

@@ -611,7 +611,7 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
} }
node = node->GetNext(); node = node->GetNext();
} }
if (src == wxEmptyString) if (src.empty())
{ {
if (m_DefaultFilter == NULL) m_DefaultFilter = GetDefaultFilter(); if (m_DefaultFilter == NULL) m_DefaultFilter = GetDefaultFilter();
src = m_DefaultFilter->ReadFile(*f); src = m_DefaultFilter->ReadFile(*f);
@@ -620,7 +620,7 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
m_FS->ChangePathTo(f->GetLocation()); m_FS->ChangePathTo(f->GetLocation());
rt_val = SetPage(src); rt_val = SetPage(src);
m_OpenedPage = f->GetLocation(); m_OpenedPage = f->GetLocation();
if (f->GetAnchor() != wxEmptyString) if (!f->GetAnchor().empty())
{ {
ScrollToAnchor(f->GetAnchor()); ScrollToAnchor(f->GetAnchor());
} }
@@ -651,7 +651,7 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
} }
} }
if (m_OpenedPageTitle == wxEmptyString) if (m_OpenedPageTitle.empty())
OnSetTitle(wxFileNameFromPath(m_OpenedPage)); OnSetTitle(wxFileNameFromPath(m_OpenedPage));
if (needs_refresh) if (needs_refresh)
@@ -832,7 +832,7 @@ void wxHtmlWindow::ReadCustomization(wxConfigBase *cfg, wxString path)
int p_fontsizes[7]; int p_fontsizes[7];
wxString p_fff, p_ffn; wxString p_fff, p_ffn;
if (path != wxEmptyString) if (!path.empty())
{ {
oldpath = cfg->GetPath(); oldpath = cfg->GetPath();
cfg->SetPath(path); cfg->SetPath(path);
@@ -848,7 +848,7 @@ void wxHtmlWindow::ReadCustomization(wxConfigBase *cfg, wxString path)
} }
SetFonts(p_ffn, p_fff, p_fontsizes); SetFonts(p_ffn, p_fff, p_fontsizes);
if (path != wxEmptyString) if (!path.empty())
cfg->SetPath(oldpath); cfg->SetPath(oldpath);
} }
@@ -859,7 +859,7 @@ void wxHtmlWindow::WriteCustomization(wxConfigBase *cfg, wxString path)
wxString oldpath; wxString oldpath;
wxString tmp; wxString tmp;
if (path != wxEmptyString) if (!path.empty())
{ {
oldpath = cfg->GetPath(); oldpath = cfg->GetPath();
cfg->SetPath(path); cfg->SetPath(path);
@@ -874,7 +874,7 @@ void wxHtmlWindow::WriteCustomization(wxConfigBase *cfg, wxString path)
cfg->Write(tmp, (long) m_Parser->m_FontsSizes[i]); cfg->Write(tmp, (long) m_Parser->m_FontsSizes[i]);
} }
if (path != wxEmptyString) if (!path.empty())
cfg->SetPath(oldpath); cfg->SetPath(oldpath);
} }
#endif // wxUSE_CONFIG #endif // wxUSE_CONFIG
@@ -897,7 +897,7 @@ bool wxHtmlWindow::HistoryBack()
a = (*m_History)[m_HistoryPos].GetAnchor(); a = (*m_History)[m_HistoryPos].GetAnchor();
m_HistoryOn = false; m_HistoryOn = false;
m_tmpCanDrawLocks++; m_tmpCanDrawLocks++;
if (a == wxEmptyString) LoadPage(l); if (a.empty()) LoadPage(l);
else LoadPage(l + wxT("#") + a); else LoadPage(l + wxT("#") + a);
m_HistoryOn = true; m_HistoryOn = true;
m_tmpCanDrawLocks--; m_tmpCanDrawLocks--;
@@ -927,7 +927,7 @@ bool wxHtmlWindow::HistoryForward()
a = (*m_History)[m_HistoryPos].GetAnchor(); a = (*m_History)[m_HistoryPos].GetAnchor();
m_HistoryOn = false; m_HistoryOn = false;
m_tmpCanDrawLocks++; m_tmpCanDrawLocks++;
if (a == wxEmptyString) LoadPage(l); if (a.empty()) LoadPage(l);
else LoadPage(l + wxT("#") + a); else LoadPage(l + wxT("#") + a);
m_HistoryOn = true; m_HistoryOn = true;
m_tmpCanDrawLocks--; m_tmpCanDrawLocks--;

View File

@@ -320,22 +320,22 @@ void wxHtmlPrintout::OnPreparePrinting()
(double)ppiPrinterY / (double)ppiScreenY); (double)ppiPrinterY / (double)ppiScreenY);
m_RendererHdr->SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginRight)), m_RendererHdr->SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginRight)),
(int) (ppmm_v * (mm_h - m_MarginTop - m_MarginBottom))); (int) (ppmm_v * (mm_h - m_MarginTop - m_MarginBottom)));
if (m_Headers[0] != wxEmptyString) if (!m_Headers[0].empty())
{ {
m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[0], 1)); m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[0], 1));
m_HeaderHeight = m_RendererHdr->GetTotalHeight(); m_HeaderHeight = m_RendererHdr->GetTotalHeight();
} }
else if (m_Headers[1] != wxEmptyString) else if (!m_Headers[1].empty())
{ {
m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[1], 1)); m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[1], 1));
m_HeaderHeight = m_RendererHdr->GetTotalHeight(); m_HeaderHeight = m_RendererHdr->GetTotalHeight();
} }
if (m_Footers[0] != wxEmptyString) if (!m_Footers[0].empty())
{ {
m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[0], 1)); m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[0], 1));
m_FooterHeight = m_RendererHdr->GetTotalHeight(); m_FooterHeight = m_RendererHdr->GetTotalHeight();
} }
else if (m_Footers[1] != wxEmptyString) else if (!m_Footers[1].empty())
{ {
m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[1], 1)); m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[1], 1));
m_FooterHeight = m_RendererHdr->GetTotalHeight(); m_FooterHeight = m_RendererHdr->GetTotalHeight();
@@ -543,12 +543,12 @@ void wxHtmlPrintout::RenderPage(wxDC *dc, int page)
m_RendererHdr->SetDC(dc, m_RendererHdr->SetDC(dc,
(double)ppiPrinterY / TYPICAL_SCREEN_DPI, (double)ppiPrinterY / TYPICAL_SCREEN_DPI,
(double)ppiPrinterY / (double)ppiScreenY); (double)ppiPrinterY / (double)ppiScreenY);
if (m_Headers[page % 2] != wxEmptyString) if (!m_Headers[page % 2].empty())
{ {
m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[page % 2], page)); m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[page % 2], page));
m_RendererHdr->Render((int) (ppmm_h * m_MarginLeft), (int) (ppmm_v * m_MarginTop), m_PageBreaks); m_RendererHdr->Render((int) (ppmm_h * m_MarginLeft), (int) (ppmm_v * m_MarginTop), m_PageBreaks);
} }
if (m_Footers[page % 2] != wxEmptyString) if (!m_Footers[page % 2].empty())
{ {
m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[page % 2], page)); m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[page % 2], page));
m_RendererHdr->Render((int) (ppmm_h * m_MarginLeft), (int) (pageHeight - ppmm_v * m_MarginBottom - m_FooterHeight), m_PageBreaks); m_RendererHdr->Render((int) (ppmm_h * m_MarginLeft), (int) (pageHeight - ppmm_v * m_MarginBottom - m_FooterHeight), m_PageBreaks);

View File

@@ -631,7 +631,7 @@ wxFont* wxHtmlWinParser::CreateCurrentFont()
void wxHtmlWinParser::SetLink(const wxHtmlLinkInfo& link) void wxHtmlWinParser::SetLink(const wxHtmlLinkInfo& link)
{ {
m_Link = link; m_Link = link;
m_UseLink = (link.GetHref() != wxEmptyString); m_UseLink = !link.GetHref().empty();
} }
void wxHtmlWinParser::SetFontFace(const wxString& face) void wxHtmlWinParser::SetFontFace(const wxString& face)

View File

@@ -131,7 +131,7 @@ int wxChoice::DoInsertItems(const wxArrayStringsAdapter & items,
} }
wxString text = items[i]; wxString text = items[i];
if (text == wxEmptyString) if (text.empty())
text = " "; // menu items can't have empty labels text = " "; // menu items can't have empty labels
m_popUpMenu->Insert( idx, i+1, text ); m_popUpMenu->Insert( idx, i+1, text );
m_datas.Insert( NULL, idx ); m_datas.Insert( NULL, idx );