Use empty() member function to determine if arrays are empty in wxPG.
Use this dedicated function instead of checking if size() function returns zero/non-zero value.
This commit is contained in:
@@ -526,9 +526,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
wxPGProperty* GetSelection() const
|
wxPGProperty* GetSelection() const
|
||||||
{
|
{
|
||||||
if ( m_selection.size() == 0 )
|
return m_selection.empty()? NULL: m_selection[0];
|
||||||
return NULL;
|
|
||||||
return m_selection[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoSetSelection( wxPGProperty* prop )
|
void DoSetSelection( wxPGProperty* prop )
|
||||||
|
@@ -722,7 +722,7 @@ bool wxPropertyGrid::DoAddToSelection( wxPGProperty* prop, int selFlags )
|
|||||||
|
|
||||||
wxArrayPGProperty& selection = m_pState->m_selection;
|
wxArrayPGProperty& selection = m_pState->m_selection;
|
||||||
|
|
||||||
if ( !selection.size() )
|
if ( selection.empty() )
|
||||||
{
|
{
|
||||||
return DoSelectProperty(prop, selFlags);
|
return DoSelectProperty(prop, selFlags);
|
||||||
}
|
}
|
||||||
@@ -935,7 +935,7 @@ bool wxPropertyGrid::AddToSelectionFromInputEvent( wxPGProperty* prop,
|
|||||||
void wxPropertyGrid::DoSetSelection( const wxArrayPGProperty& newSelection,
|
void wxPropertyGrid::DoSetSelection( const wxArrayPGProperty& newSelection,
|
||||||
int selFlags )
|
int selFlags )
|
||||||
{
|
{
|
||||||
if ( newSelection.size() > 0 )
|
if ( !newSelection.empty() )
|
||||||
{
|
{
|
||||||
if ( !DoSelectProperty(newSelection[0], selFlags) )
|
if ( !DoSelectProperty(newSelection[0], selFlags) )
|
||||||
return;
|
return;
|
||||||
@@ -4065,10 +4065,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
|
|||||||
wxArrayPGProperty prevSelection = m_pState->m_selection;
|
wxArrayPGProperty prevSelection = m_pState->m_selection;
|
||||||
wxPGProperty* prevFirstSel;
|
wxPGProperty* prevFirstSel;
|
||||||
|
|
||||||
if ( prevSelection.size() > 0 )
|
prevFirstSel = prevSelection.empty()? NULL: prevSelection[0];
|
||||||
prevFirstSel = prevSelection[0];
|
|
||||||
else
|
|
||||||
prevFirstSel = NULL;
|
|
||||||
|
|
||||||
if ( prevFirstSel && prevFirstSel->HasFlag(wxPG_PROP_BEING_DELETED) )
|
if ( prevFirstSel && prevFirstSel->HasFlag(wxPG_PROP_BEING_DELETED) )
|
||||||
prevFirstSel = NULL;
|
prevFirstSel = NULL;
|
||||||
@@ -6251,7 +6248,7 @@ void wxPGChoicesData::Clear()
|
|||||||
|
|
||||||
void wxPGChoicesData::CopyDataFrom( wxPGChoicesData* data )
|
void wxPGChoicesData::CopyDataFrom( wxPGChoicesData* data )
|
||||||
{
|
{
|
||||||
wxASSERT( m_items.size() == 0 );
|
wxASSERT( m_items.empty() );
|
||||||
|
|
||||||
m_items = data->m_items;
|
m_items = data->m_items;
|
||||||
}
|
}
|
||||||
|
@@ -1036,7 +1036,7 @@ bool wxPropertyGridInterface::RestoreEditableState( const wxString& src, int res
|
|||||||
{
|
{
|
||||||
if ( restoreStates & SelectionState )
|
if ( restoreStates & SelectionState )
|
||||||
{
|
{
|
||||||
if ( values.size() > 0 )
|
if ( !values.empty() )
|
||||||
{
|
{
|
||||||
if ( pageState->IsDisplayed() )
|
if ( pageState->IsDisplayed() )
|
||||||
{
|
{
|
||||||
|
@@ -1381,11 +1381,7 @@ void wxPropertyGridPageState::DoRemoveFromSelection( wxPGProperty* prop )
|
|||||||
wxArrayPGProperty sel = m_selection;
|
wxArrayPGProperty sel = m_selection;
|
||||||
sel.erase( sel.begin() + i );
|
sel.erase( sel.begin() + i );
|
||||||
|
|
||||||
wxPGProperty* newFirst;
|
wxPGProperty* newFirst = sel.empty()? NULL: sel[0];
|
||||||
if ( sel.size() )
|
|
||||||
newFirst = sel[0];
|
|
||||||
else
|
|
||||||
newFirst = NULL;
|
|
||||||
|
|
||||||
pg->DoSelectProperty(newFirst,
|
pg->DoSelectProperty(newFirst,
|
||||||
wxPG_SEL_DONT_SEND_EVENT);
|
wxPG_SEL_DONT_SEND_EVENT);
|
||||||
|
@@ -1207,7 +1207,7 @@ wxEnumProperty::wxEnumProperty( const wxString& label, const wxString& name,
|
|||||||
{
|
{
|
||||||
SetIndex(0);
|
SetIndex(0);
|
||||||
|
|
||||||
if ( &labels && labels.size() )
|
if ( &labels && !labels.empty() )
|
||||||
{
|
{
|
||||||
m_choices.Set(labels, values);
|
m_choices.Set(labels, values);
|
||||||
|
|
||||||
@@ -1595,7 +1595,7 @@ wxFlagsProperty::wxFlagsProperty( const wxString& label, const wxString& name,
|
|||||||
{
|
{
|
||||||
m_oldChoicesData = NULL;
|
m_oldChoicesData = NULL;
|
||||||
|
|
||||||
if ( &labels && labels.size() )
|
if ( &labels && !labels.empty() )
|
||||||
{
|
{
|
||||||
m_choices.Set(labels,values);
|
m_choices.Set(labels,values);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user