Use wxString's empty() when checking if the string is (non-)empty throughout wx.
Instead of constructs such as if "( s.length() )" and "if (s.length() > 0)" use "if ( !s.empty() )" instead. Similarly for "if (s.length() == 0)" or "if ( s.IsNull() )", use "if ( s.empty() )". No code changes intended except for a few instances where a construct like "if ( s.length() && wxFileExists(s) )" was changed to not check the length of the string and let wxFileExists handle such cases. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66728 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -634,7 +634,7 @@ wxFontProperty::wxFontProperty( const wxString& label, const wxString& name,
|
||||
|
||||
wxString faceName = font.GetFaceName();
|
||||
// If font was not in there, add it now
|
||||
if ( faceName.length() &&
|
||||
if ( !faceName.empty() &&
|
||||
wxPGGlobalVars->m_fontFamilyChoices->Index(faceName) == wxNOT_FOUND )
|
||||
wxPGGlobalVars->m_fontFamilyChoices->AddAsSorted(faceName);
|
||||
|
||||
@@ -797,7 +797,7 @@ void wxFontProperty::OnCustomPaint(wxDC& dc,
|
||||
else
|
||||
drawFace = m_value_wxFont.GetFaceName();
|
||||
|
||||
if ( drawFace.length() )
|
||||
if ( !drawFace.empty() )
|
||||
{
|
||||
// Draw the background
|
||||
dc.SetBrush( wxColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)) );
|
||||
@@ -1782,7 +1782,7 @@ void wxCursorProperty::OnCustomPaint( wxDC&, const wxRect&, wxPGPaintData& ) { }
|
||||
const wxString& wxPGGetDefaultImageWildcard()
|
||||
{
|
||||
// Form the wildcard, if not done yet
|
||||
if ( !wxPGGlobalVars->m_pDefaultImageWildcard.length() )
|
||||
if ( wxPGGlobalVars->m_pDefaultImageWildcard.empty() )
|
||||
{
|
||||
|
||||
wxString str;
|
||||
@@ -2179,7 +2179,7 @@ wxString wxDateProperty::ValueToString( wxVariant& value,
|
||||
if ( !dateTime.IsValid() )
|
||||
return wxT("Invalid");
|
||||
|
||||
if ( !ms_defaultDateFormat.length() )
|
||||
if ( ms_defaultDateFormat.empty() )
|
||||
{
|
||||
#if wxUSE_DATEPICKCTRL
|
||||
bool showCentury = m_dpStyle & wxDP_SHOWCENTURY ? true : false;
|
||||
@@ -2189,7 +2189,7 @@ wxString wxDateProperty::ValueToString( wxVariant& value,
|
||||
ms_defaultDateFormat = DetermineDefaultDateFormat( showCentury );
|
||||
}
|
||||
|
||||
if ( m_format.length() &&
|
||||
if ( !m_format.empty() &&
|
||||
!(argFlags & wxPG_FULL_VALUE) )
|
||||
format = m_format.c_str();
|
||||
|
||||
|
Reference in New Issue
Block a user