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:
@@ -1548,7 +1548,7 @@ wxTextCtrl* MyFrame::CreateTextCtrl(const wxString& ctrl_text)
|
||||
static int n = 0;
|
||||
|
||||
wxString text;
|
||||
if (ctrl_text.Length() > 0)
|
||||
if ( !ctrl_text.empty() )
|
||||
text = ctrl_text;
|
||||
else
|
||||
text.Printf(wxT("This is text box %d"), ++n);
|
||||
|
@@ -322,7 +322,7 @@ public:
|
||||
wxString s = ::wxGetSingleChoice(wxT("Message"),
|
||||
wxT("Caption"),
|
||||
m_choices.GetLabels());
|
||||
if ( s.length() )
|
||||
if ( !s.empty() )
|
||||
{
|
||||
SetValue(s);
|
||||
return true;
|
||||
|
@@ -618,7 +618,7 @@ bool wxArrayDoubleProperty::StringToValue( wxVariant& variant, const wxString& t
|
||||
|
||||
WX_PG_TOKENIZER1_BEGIN(text,delimiter)
|
||||
|
||||
if ( token.length() )
|
||||
if ( !token.empty() )
|
||||
{
|
||||
|
||||
// If token was invalid, exit the loop now
|
||||
|
@@ -884,7 +884,7 @@ wxBitmap BitmapComboBoxWidgetsPage::QueryBitmap(wxString* pStr)
|
||||
|
||||
::wxSetCursor( *wxHOURGLASS_CURSOR );
|
||||
|
||||
if ( filepath.length() )
|
||||
if ( !filepath.empty() )
|
||||
{
|
||||
if ( pStr )
|
||||
{
|
||||
|
Reference in New Issue
Block a user