Use wxString::clear() instead of assignment to wxEmptyString

This commit is contained in:
Paul Cornett 2018-05-11 10:52:56 -07:00
parent 7d039a2e0b
commit 98cd5a6b20
18 changed files with 30 additions and 33 deletions

View File

@ -6412,7 +6412,7 @@ wxAccStatus wxDataViewCtrlAccessible::GetHelpText(int childId, wxString* helpTex
} }
else else
{ {
*helpText = wxEmptyString; helpText->clear();
} }
} }
return wxACC_OK; return wxACC_OK;

View File

@ -465,7 +465,7 @@ void wxGenericDirCtrl::Init()
{ {
m_showHidden = false; m_showHidden = false;
m_currentFilter = 0; m_currentFilter = 0;
m_currentFilterStr = wxEmptyString; // Default: any file m_currentFilterStr.clear(); // Default: any file
m_treeCtrl = NULL; m_treeCtrl = NULL;
m_filterListCtrl = NULL; m_filterListCtrl = NULL;
} }

View File

@ -674,7 +674,7 @@ void wxFileListCtrl::GoToParentDir()
if (!m_dirName.empty()) if (!m_dirName.empty())
{ {
if (m_dirName.Last() == wxT('.')) if (m_dirName.Last() == wxT('.'))
m_dirName = wxEmptyString; m_dirName.clear();
} }
#elif defined(__UNIX__) #elif defined(__UNIX__)
if (m_dirName.empty()) if (m_dirName.empty())
@ -927,7 +927,7 @@ bool wxGenericFileCtrl::Create( wxWindow *parent,
if ( ( len > 1 ) && ( wxEndsWithPathSeparator( m_dir ) ) ) if ( ( len > 1 ) && ( wxEndsWithPathSeparator( m_dir ) ) )
m_dir.Remove( len - 1, 1 ); m_dir.Remove( len - 1, 1 );
m_filterExtension = wxEmptyString; m_filterExtension.clear();
// layout // layout

View File

@ -187,7 +187,7 @@ bool wxGenericFileDialog::Create( wxWindow *parent,
if ((len > 1) && (wxEndsWithPathSeparator(m_dir))) if ((len > 1) && (wxEndsWithPathSeparator(m_dir)))
m_dir.Remove( len-1, 1 ); m_dir.Remove( len-1, 1 );
m_filterExtension = wxEmptyString; m_filterExtension.clear();
// layout // layout

View File

@ -1311,7 +1311,7 @@ void wxGridStringTable::Clear()
{ {
for ( col = 0; col < numCols; col++ ) for ( col = 0; col < numCols; col++ )
{ {
m_data[row][col] = wxEmptyString; m_data[row][col].clear();
} }
} }
} }

View File

@ -422,7 +422,7 @@ bool wxExtHelpController::KeywordSearch(const wxString& k,
// choices[idx] = (**i).doc.Contains((**i).doc.Before(WXEXTHELP_COMMENTCHAR)); // choices[idx] = (**i).doc.Contains((**i).doc.Before(WXEXTHELP_COMMENTCHAR));
//if (choices[idx].empty()) // didn't contain the ';' //if (choices[idx].empty()) // didn't contain the ';'
// choices[idx] = (**i).doc; // choices[idx] = (**i).doc;
choices[idx] = wxEmptyString; choices[idx].clear();
for (int j=0; ; j++) for (int j=0; ; j++)
{ {
wxChar targetChar = entry->doc.c_str()[j]; wxChar targetChar = entry->doc.c_str()[j];

View File

@ -68,7 +68,7 @@ void wxVListBoxComboPopup::Init()
m_value = -1; m_value = -1;
m_itemHover = -1; m_itemHover = -1;
m_clientDataItemsType = wxClientData_None; m_clientDataItemsType = wxClientData_None;
m_partialCompletionString = wxEmptyString; m_partialCompletionString.clear();
} }
bool wxVListBoxComboPopup::Create(wxWindow* parent) bool wxVListBoxComboPopup::Create(wxWindow* parent)
@ -224,7 +224,7 @@ void wxVListBoxComboPopup::DismissWithEvent()
if ( selection != wxNOT_FOUND ) if ( selection != wxNOT_FOUND )
m_stringValue = m_strings[selection]; m_stringValue = m_strings[selection];
else else
m_stringValue = wxEmptyString; m_stringValue.clear();
if ( m_stringValue != m_combo->GetValue() ) if ( m_stringValue != m_combo->GetValue() )
m_combo->SetValueByUser(m_stringValue); m_combo->SetValueByUser(m_stringValue);
@ -388,7 +388,7 @@ bool wxVListBoxComboPopup::HandleKey( int keycode, bool saturate, wxChar keychar
// stop partial completion // stop partial completion
void wxVListBoxComboPopup::StopPartialCompletion() void wxVListBoxComboPopup::StopPartialCompletion()
{ {
m_partialCompletionString = wxEmptyString; m_partialCompletionString.clear();
#if wxUSE_TIMER #if wxUSE_TIMER
m_partialCompletionTimer.Stop(); m_partialCompletionTimer.Stop();
#endif // wxUSE_TIMER #endif // wxUSE_TIMER
@ -685,7 +685,7 @@ void wxVListBoxComboPopup::SetSelection( int item )
if ( item >= 0 ) if ( item >= 0 )
m_stringValue = m_strings[item]; m_stringValue = m_strings[item];
else else
m_stringValue = wxEmptyString; m_stringValue.clear();
if ( IsCreated() ) if ( IsCreated() )
wxVListBox::SetSelection(item); wxVListBox::SetSelection(item);

View File

@ -714,7 +714,8 @@ TAG_HANDLER_BEGIN(TABLE, "TABLE,TR,TD,TH")
{ {
m_Table = NULL; m_Table = NULL;
m_enclosingContainer = NULL; m_enclosingContainer = NULL;
m_tAlign = m_rAlign = wxEmptyString; m_tAlign.clear();
m_rAlign.clear();
} }

View File

@ -587,7 +587,7 @@ void wxFontDialog::ChangeFont()
wxFontFamily family = FontFamilyStringToInt(facename); wxFontFamily family = FontFamilyStringToInt(facename);
if (family != wxFONTFAMILY_DEFAULT) if (family != wxFONTFAMILY_DEFAULT)
facename = wxEmptyString; facename.clear();
m_dialogFont = wxFontInfo(size) m_dialogFont = wxFontInfo(size)
.Family(family).FaceName(facename) .Family(family).FaceName(facename)

View File

@ -3453,7 +3453,7 @@ void wxDataViewColumn::SetBitmap(const wxBitmap& bitmap)
{ {
// bitmaps and titles cannot exist at the same time - if the bitmap is set // bitmaps and titles cannot exist at the same time - if the bitmap is set
// the title is removed: // the title is removed:
m_title = wxEmptyString; m_title.clear();
wxDataViewColumnBase::SetBitmap(bitmap); wxDataViewColumnBase::SetBitmap(bitmap);
[[m_NativeDataPtr->GetNativeColumnPtr() headerCell] setImage:bitmap.GetNSImage()]; [[m_NativeDataPtr->GetNativeColumnPtr() headerCell] setImage:bitmap.GetNSImage()];
} }

View File

@ -113,7 +113,7 @@ int wxDirDialog::ShowModal()
wxCFStringRef dir( m_path ); wxCFStringRef dir( m_path );
m_path = wxEmptyString; m_path.clear();
int returnCode = -1; int returnCode = -1;

View File

@ -494,7 +494,7 @@ int wxFileDialog::ShowModal()
wxCFStringRef dir( m_dir ); wxCFStringRef dir( m_dir );
wxCFStringRef file( m_fileName ); wxCFStringRef file( m_fileName );
m_path = wxEmptyString; m_path.clear();
m_fileNames.Clear(); m_fileNames.Clear();
m_paths.Clear(); m_paths.Clear();

View File

@ -540,7 +540,7 @@ bool wxMimeTypesManagerImpl::GetMimeType(const wxString& uti, wxString *mimeType
if( itr == m_utiMap.end() || itr->second.mimeTypes.GetCount() < 1 ) if( itr == m_utiMap.end() || itr->second.mimeTypes.GetCount() < 1 )
{ {
*mimeType = wxEmptyString; mimeType->clear();
return false; return false;
} }
@ -582,7 +582,7 @@ bool wxMimeTypesManagerImpl::GetDescription(const wxString& uti, wxString *desc)
if( itr == m_utiMap.end() || itr->second.description.empty() ) if( itr == m_utiMap.end() || itr->second.description.empty() )
{ {
*desc = wxEmptyString; desc->clear();
return false; return false;
} }

View File

@ -2815,7 +2815,7 @@ wxRichTextRange wxRichTextParagraphLayoutBox::AddParagraphs(const wxString& text
AppendChild(para); AppendChild(para);
lastPara = para; lastPara = para;
line = wxEmptyString; line.clear();
} }
} }
else else
@ -4757,7 +4757,7 @@ bool wxRichTextParagraphLayoutBox::FindNextParagraphNumber(wxRichTextParagraph*
text = text.Mid(0, text.Length() - pos - 1); text = text.Mid(0, text.Length() - pos - 1);
} }
else else
text = wxEmptyString; text.clear();
if (!text.IsEmpty()) if (!text.IsEmpty())
text += wxT("."); text += wxT(".");
text += wxString::Format(wxT("%d"), nextNumber); text += wxString::Format(wxT("%d"), nextNumber);
@ -6297,7 +6297,7 @@ wxRichTextObject* wxRichTextParagraph::FindObjectAtPosition(long position)
/// The resulting string may be shorter than the range given. /// The resulting string may be shorter than the range given.
bool wxRichTextParagraph::GetContiguousPlainText(wxString& text, const wxRichTextRange& range, bool fromStart) bool wxRichTextParagraph::GetContiguousPlainText(wxString& text, const wxRichTextRange& range, bool fromStart)
{ {
text = wxEmptyString; text.clear();
if (fromStart) if (fromStart)
{ {
@ -13623,7 +13623,7 @@ void wxTextBoxAttr::Reset()
m_whitespaceMode = wxTEXT_BOX_ATTR_WHITESPACE_NONE; m_whitespaceMode = wxTEXT_BOX_ATTR_WHITESPACE_NONE;
m_collapseMode = wxTEXT_BOX_ATTR_COLLAPSE_NONE; m_collapseMode = wxTEXT_BOX_ATTR_COLLAPSE_NONE;
m_verticalAlignment = wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_NONE; m_verticalAlignment = wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_NONE;
m_boxStyleName = wxEmptyString; m_boxStyleName.clear();
m_margins.Reset(); m_margins.Reset();
m_padding.Reset(); m_padding.Reset();

View File

@ -744,7 +744,7 @@ void wxRichTextHeaderFooterData::Clear()
{ {
int i; int i;
for (i = 0; i < 12; i++) for (i = 0; i < 12; i++)
m_text[i] = wxEmptyString; m_text[i].clear();
} }
#endif // wxUSE_RICHTEXT & wxUSE_PRINTING_ARCHITECTURE #endif // wxUSE_RICHTEXT & wxUSE_PRINTING_ARCHITECTURE

View File

@ -605,7 +605,7 @@ void wxSymbolPickerDialog::ShowAtSubset()
void wxSymbolPickerDialog::OnFontCtrlSelected( wxCommandEvent& WXUNUSED(event) ) void wxSymbolPickerDialog::OnFontCtrlSelected( wxCommandEvent& WXUNUSED(event) )
{ {
if (m_fontCtrl->GetSelection() == 0) if (m_fontCtrl->GetSelection() == 0)
m_fontName = wxEmptyString; m_fontName.clear();
else else
m_fontName = m_fontCtrl->GetStringSelection(); m_fontName = m_fontCtrl->GetStringSelection();
@ -619,13 +619,9 @@ void wxSymbolPickerDialog::OnSymbolSelected( wxCommandEvent& event )
return; return;
int sel = event.GetSelection(); int sel = event.GetSelection();
if (sel == wxNOT_FOUND) m_symbol.clear();
m_symbol = wxEmptyString; if (sel != wxNOT_FOUND)
else
{
m_symbol = wxEmptyString;
m_symbol << (wxChar) sel; m_symbol << (wxChar) sel;
}
#if defined(__UNICODE__) #if defined(__UNICODE__)
if (sel != -1 && m_fromUnicode) if (sel != -1 && m_fromUnicode)

View File

@ -1083,7 +1083,7 @@ void wxRichTextXMLHelper::Clear()
m_convMem = NULL; m_convMem = NULL;
m_deleteConvFile = false; m_deleteConvFile = false;
#endif #endif
m_fileEncoding = wxEmptyString; m_fileEncoding.clear();
} }
void wxRichTextXMLHelper::SetupForSaving(const wxString& enc) void wxRichTextXMLHelper::SetupForSaving(const wxString& enc)

View File

@ -548,8 +548,8 @@ void ScintillaWX::Paste() {
#if wxUSE_UNICODE #if wxUSE_UNICODE
// free up the old character buffer in case the text is real big // free up the old character buffer in case the text is real big
data.SetText(wxEmptyString); text.clear();
text = wxEmptyString; data.SetText(text);
#endif #endif
const size_t len = buf.length(); const size_t len = buf.length();
SelectionPosition selStart = sel.IsRectangular() ? SelectionPosition selStart = sel.IsRectangular() ?