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
 | 
			
		||||
    {
 | 
			
		||||
        if ( m_selection.size() == 0 )
 | 
			
		||||
            return NULL;
 | 
			
		||||
        return m_selection[0];
 | 
			
		||||
        return m_selection.empty()? NULL: m_selection[0];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void DoSetSelection( wxPGProperty* prop )
 | 
			
		||||
 
 | 
			
		||||
@@ -722,7 +722,7 @@ bool wxPropertyGrid::DoAddToSelection( wxPGProperty* prop, int selFlags )
 | 
			
		||||
 | 
			
		||||
    wxArrayPGProperty& selection = m_pState->m_selection;
 | 
			
		||||
 | 
			
		||||
    if ( !selection.size() )
 | 
			
		||||
    if ( selection.empty() )
 | 
			
		||||
    {
 | 
			
		||||
        return DoSelectProperty(prop, selFlags);
 | 
			
		||||
    }
 | 
			
		||||
@@ -935,7 +935,7 @@ bool wxPropertyGrid::AddToSelectionFromInputEvent( wxPGProperty* prop,
 | 
			
		||||
void wxPropertyGrid::DoSetSelection( const wxArrayPGProperty& newSelection,
 | 
			
		||||
                                     int selFlags )
 | 
			
		||||
{
 | 
			
		||||
    if ( newSelection.size() > 0 )
 | 
			
		||||
    if ( !newSelection.empty() )
 | 
			
		||||
    {
 | 
			
		||||
        if ( !DoSelectProperty(newSelection[0], selFlags) )
 | 
			
		||||
            return;
 | 
			
		||||
@@ -4065,10 +4065,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
 | 
			
		||||
    wxArrayPGProperty prevSelection = m_pState->m_selection;
 | 
			
		||||
    wxPGProperty* prevFirstSel;
 | 
			
		||||
 | 
			
		||||
    if ( prevSelection.size() > 0 )
 | 
			
		||||
        prevFirstSel = prevSelection[0];
 | 
			
		||||
    else
 | 
			
		||||
        prevFirstSel = NULL;
 | 
			
		||||
    prevFirstSel = prevSelection.empty()? NULL: prevSelection[0];
 | 
			
		||||
 | 
			
		||||
    if ( prevFirstSel && prevFirstSel->HasFlag(wxPG_PROP_BEING_DELETED) )
 | 
			
		||||
        prevFirstSel = NULL;
 | 
			
		||||
@@ -6251,7 +6248,7 @@ void wxPGChoicesData::Clear()
 | 
			
		||||
 | 
			
		||||
void wxPGChoicesData::CopyDataFrom( wxPGChoicesData* data )
 | 
			
		||||
{
 | 
			
		||||
    wxASSERT( m_items.size() == 0 );
 | 
			
		||||
    wxASSERT( m_items.empty() );
 | 
			
		||||
 | 
			
		||||
    m_items = data->m_items;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1036,7 +1036,7 @@ bool wxPropertyGridInterface::RestoreEditableState( const wxString& src, int res
 | 
			
		||||
                {
 | 
			
		||||
                    if ( restoreStates & SelectionState )
 | 
			
		||||
                    {
 | 
			
		||||
                        if ( values.size() > 0 )
 | 
			
		||||
                        if ( !values.empty() )
 | 
			
		||||
                        {
 | 
			
		||||
                            if ( pageState->IsDisplayed() )
 | 
			
		||||
                            {
 | 
			
		||||
 
 | 
			
		||||
@@ -1381,11 +1381,7 @@ void wxPropertyGridPageState::DoRemoveFromSelection( wxPGProperty* prop )
 | 
			
		||||
                wxArrayPGProperty sel = m_selection;
 | 
			
		||||
                sel.erase( sel.begin() + i );
 | 
			
		||||
 | 
			
		||||
                wxPGProperty* newFirst;
 | 
			
		||||
                if ( sel.size() )
 | 
			
		||||
                    newFirst = sel[0];
 | 
			
		||||
                else
 | 
			
		||||
                    newFirst = NULL;
 | 
			
		||||
                wxPGProperty* newFirst = sel.empty()? NULL: sel[0];
 | 
			
		||||
 | 
			
		||||
                pg->DoSelectProperty(newFirst,
 | 
			
		||||
                                     wxPG_SEL_DONT_SEND_EVENT);
 | 
			
		||||
 
 | 
			
		||||
@@ -1207,7 +1207,7 @@ wxEnumProperty::wxEnumProperty( const wxString& label, const wxString& name,
 | 
			
		||||
{
 | 
			
		||||
    SetIndex(0);
 | 
			
		||||
 | 
			
		||||
    if ( &labels && labels.size() )
 | 
			
		||||
    if ( &labels && !labels.empty() )
 | 
			
		||||
    {
 | 
			
		||||
        m_choices.Set(labels, values);
 | 
			
		||||
 | 
			
		||||
@@ -1595,7 +1595,7 @@ wxFlagsProperty::wxFlagsProperty( const wxString& label, const wxString& name,
 | 
			
		||||
{
 | 
			
		||||
    m_oldChoicesData = NULL;
 | 
			
		||||
 | 
			
		||||
    if ( &labels && labels.size() )
 | 
			
		||||
    if ( &labels && !labels.empty() )
 | 
			
		||||
    {
 | 
			
		||||
        m_choices.Set(labels,values);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user