Use wxString::empty() instead of comparison to wxEmptyString
This commit is contained in:
parent
d16afbd3c1
commit
c1f2bbce5d
@ -936,7 +936,7 @@ bool wxGenericDirCtrl::ExpandPath(const wxString& path)
|
||||
{
|
||||
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->EnsureVisible(childId);
|
||||
|
@ -6359,7 +6359,7 @@ void wxGrid::ShowCellEditControl()
|
||||
// resize editor to overflow into righthand cells if allowed
|
||||
int maxWidth = rect.width;
|
||||
wxString value = GetCellValue(row, col);
|
||||
if ( (value != wxEmptyString) && (attr->GetOverflow()) )
|
||||
if ( !value.empty() && attr->GetOverflow() )
|
||||
{
|
||||
int y;
|
||||
GetTextExtent(value, &maxWidth, &y, NULL, NULL, &attr->GetFont());
|
||||
|
@ -164,7 +164,7 @@ wxString wxFileTipProvider::GetTip()
|
||||
|
||||
// Break if tip isn't a comment, and isn't an empty string
|
||||
// (or only stray space characters).
|
||||
if ( !tip.StartsWith(wxT("#")) && (tip.Trim() != wxEmptyString) )
|
||||
if ( !tip.StartsWith(wxT("#")) && !tip.Trim().empty() )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -700,7 +700,7 @@ bool wxHtmlHelpData::AddBook(const wxString& book)
|
||||
|
||||
wxFontEncoding enc = wxFONTENCODING_SYSTEM;
|
||||
#if wxUSE_FONTMAP
|
||||
if (charset != wxEmptyString)
|
||||
if (!charset.empty())
|
||||
enc = wxFontMapper::Get()->CharsetToEncoding(charset);
|
||||
#endif
|
||||
|
||||
@ -807,7 +807,7 @@ wxHtmlSearchStatus::wxHtmlSearchStatus(wxHtmlHelpData* data, const wxString& key
|
||||
m_Data = data;
|
||||
m_Keyword = keyword;
|
||||
wxHtmlBookRecord* bookr = NULL;
|
||||
if (book != wxEmptyString)
|
||||
if (!book.empty())
|
||||
{
|
||||
// we have to search in a specific book. Find it first
|
||||
int i, cnt = data->m_bookRecords.GetCount();
|
||||
|
@ -1073,7 +1073,7 @@ void wxHtmlHelpWindow::ReadCustomization(wxConfigBase *cfg, const wxString& path
|
||||
wxString oldpath;
|
||||
wxString tmp;
|
||||
|
||||
if (path != wxEmptyString)
|
||||
if (!path.empty())
|
||||
{
|
||||
oldpath = cfg->GetPath();
|
||||
cfg->SetPath(wxT("/") + path);
|
||||
@ -1122,7 +1122,7 @@ void wxHtmlHelpWindow::ReadCustomization(wxConfigBase *cfg, const wxString& path
|
||||
if (m_HtmlWin)
|
||||
m_HtmlWin->ReadCustomization(cfg);
|
||||
|
||||
if (path != wxEmptyString)
|
||||
if (!path.empty())
|
||||
cfg->SetPath(oldpath);
|
||||
}
|
||||
|
||||
@ -1131,7 +1131,7 @@ void wxHtmlHelpWindow::WriteCustomization(wxConfigBase *cfg, const wxString& pat
|
||||
wxString oldpath;
|
||||
wxString tmp;
|
||||
|
||||
if (path != wxEmptyString)
|
||||
if (!path.empty())
|
||||
{
|
||||
oldpath = cfg->GetPath();
|
||||
cfg->SetPath(wxT("/") + path);
|
||||
@ -1170,7 +1170,7 @@ void wxHtmlHelpWindow::WriteCustomization(wxConfigBase *cfg, const wxString& pat
|
||||
if (m_HtmlWin)
|
||||
m_HtmlWin->WriteCustomization(cfg);
|
||||
|
||||
if (path != wxEmptyString)
|
||||
if (!path.empty())
|
||||
cfg->SetPath(oldpath);
|
||||
}
|
||||
#endif // wxUSE_CONFIG
|
||||
@ -1495,7 +1495,7 @@ void wxHtmlHelpWindow::OnToolbar(wxCommandEvent& event)
|
||||
|
||||
item = m_HtmlWin->GetOpenedPageTitle();
|
||||
url = m_HtmlWin->GetOpenedPage();
|
||||
if (item == wxEmptyString)
|
||||
if (item.empty())
|
||||
item = url.AfterLast(wxT('/'));
|
||||
if (m_BookmarksPages.Index(url) == wxNOT_FOUND)
|
||||
{
|
||||
@ -1612,7 +1612,7 @@ void wxHtmlHelpWindow::DoIndexFind()
|
||||
{
|
||||
wxString sr = m_IndexText->GetLineText(0);
|
||||
sr.MakeLower();
|
||||
if (sr == wxEmptyString)
|
||||
if (sr.empty())
|
||||
{
|
||||
DoIndexAll();
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ wxHtmlCell::AdjustPagebreak(int *pagebreak,
|
||||
void wxHtmlCell::SetLink(const wxHtmlLinkInfo& link)
|
||||
{
|
||||
wxDELETE(m_Link);
|
||||
if (link.GetHref() != wxEmptyString)
|
||||
if (!link.GetHref().empty())
|
||||
m_Link = new wxHtmlLinkInfo(link);
|
||||
}
|
||||
|
||||
|
@ -611,7 +611,7 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
|
||||
}
|
||||
node = node->GetNext();
|
||||
}
|
||||
if (src == wxEmptyString)
|
||||
if (src.empty())
|
||||
{
|
||||
if (m_DefaultFilter == NULL) m_DefaultFilter = GetDefaultFilter();
|
||||
src = m_DefaultFilter->ReadFile(*f);
|
||||
@ -620,7 +620,7 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
|
||||
m_FS->ChangePathTo(f->GetLocation());
|
||||
rt_val = SetPage(src);
|
||||
m_OpenedPage = f->GetLocation();
|
||||
if (f->GetAnchor() != wxEmptyString)
|
||||
if (!f->GetAnchor().empty())
|
||||
{
|
||||
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));
|
||||
|
||||
if (needs_refresh)
|
||||
@ -832,7 +832,7 @@ void wxHtmlWindow::ReadCustomization(wxConfigBase *cfg, wxString path)
|
||||
int p_fontsizes[7];
|
||||
wxString p_fff, p_ffn;
|
||||
|
||||
if (path != wxEmptyString)
|
||||
if (!path.empty())
|
||||
{
|
||||
oldpath = cfg->GetPath();
|
||||
cfg->SetPath(path);
|
||||
@ -848,7 +848,7 @@ void wxHtmlWindow::ReadCustomization(wxConfigBase *cfg, wxString path)
|
||||
}
|
||||
SetFonts(p_ffn, p_fff, p_fontsizes);
|
||||
|
||||
if (path != wxEmptyString)
|
||||
if (!path.empty())
|
||||
cfg->SetPath(oldpath);
|
||||
}
|
||||
|
||||
@ -859,7 +859,7 @@ void wxHtmlWindow::WriteCustomization(wxConfigBase *cfg, wxString path)
|
||||
wxString oldpath;
|
||||
wxString tmp;
|
||||
|
||||
if (path != wxEmptyString)
|
||||
if (!path.empty())
|
||||
{
|
||||
oldpath = cfg->GetPath();
|
||||
cfg->SetPath(path);
|
||||
@ -874,7 +874,7 @@ void wxHtmlWindow::WriteCustomization(wxConfigBase *cfg, wxString path)
|
||||
cfg->Write(tmp, (long) m_Parser->m_FontsSizes[i]);
|
||||
}
|
||||
|
||||
if (path != wxEmptyString)
|
||||
if (!path.empty())
|
||||
cfg->SetPath(oldpath);
|
||||
}
|
||||
#endif // wxUSE_CONFIG
|
||||
@ -897,7 +897,7 @@ bool wxHtmlWindow::HistoryBack()
|
||||
a = (*m_History)[m_HistoryPos].GetAnchor();
|
||||
m_HistoryOn = false;
|
||||
m_tmpCanDrawLocks++;
|
||||
if (a == wxEmptyString) LoadPage(l);
|
||||
if (a.empty()) LoadPage(l);
|
||||
else LoadPage(l + wxT("#") + a);
|
||||
m_HistoryOn = true;
|
||||
m_tmpCanDrawLocks--;
|
||||
@ -927,7 +927,7 @@ bool wxHtmlWindow::HistoryForward()
|
||||
a = (*m_History)[m_HistoryPos].GetAnchor();
|
||||
m_HistoryOn = false;
|
||||
m_tmpCanDrawLocks++;
|
||||
if (a == wxEmptyString) LoadPage(l);
|
||||
if (a.empty()) LoadPage(l);
|
||||
else LoadPage(l + wxT("#") + a);
|
||||
m_HistoryOn = true;
|
||||
m_tmpCanDrawLocks--;
|
||||
|
@ -320,22 +320,22 @@ void wxHtmlPrintout::OnPreparePrinting()
|
||||
(double)ppiPrinterY / (double)ppiScreenY);
|
||||
m_RendererHdr->SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginRight)),
|
||||
(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_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_HeaderHeight = m_RendererHdr->GetTotalHeight();
|
||||
}
|
||||
if (m_Footers[0] != wxEmptyString)
|
||||
if (!m_Footers[0].empty())
|
||||
{
|
||||
m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[0], 1));
|
||||
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_FooterHeight = m_RendererHdr->GetTotalHeight();
|
||||
@ -543,12 +543,12 @@ void wxHtmlPrintout::RenderPage(wxDC *dc, int page)
|
||||
m_RendererHdr->SetDC(dc,
|
||||
(double)ppiPrinterY / TYPICAL_SCREEN_DPI,
|
||||
(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->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->Render((int) (ppmm_h * m_MarginLeft), (int) (pageHeight - ppmm_v * m_MarginBottom - m_FooterHeight), m_PageBreaks);
|
||||
|
@ -631,7 +631,7 @@ wxFont* wxHtmlWinParser::CreateCurrentFont()
|
||||
void wxHtmlWinParser::SetLink(const wxHtmlLinkInfo& link)
|
||||
{
|
||||
m_Link = link;
|
||||
m_UseLink = (link.GetHref() != wxEmptyString);
|
||||
m_UseLink = !link.GetHref().empty();
|
||||
}
|
||||
|
||||
void wxHtmlWinParser::SetFontFace(const wxString& face)
|
||||
|
@ -131,7 +131,7 @@ int wxChoice::DoInsertItems(const wxArrayStringsAdapter & items,
|
||||
}
|
||||
|
||||
wxString text = items[i];
|
||||
if (text == wxEmptyString)
|
||||
if (text.empty())
|
||||
text = " "; // menu items can't have empty labels
|
||||
m_popUpMenu->Insert( idx, i+1, text );
|
||||
m_datas.Insert( NULL, idx );
|
||||
|
Loading…
Reference in New Issue
Block a user