Use conditional operators to simplify statements
This commit is contained in:
parent
763f4141bc
commit
c09f1c258b
5 changed files with 11 additions and 31 deletions
|
|
@ -627,9 +627,7 @@ private:
|
|||
|
||||
inline int wxPropertyGridPage::GetIndex() const
|
||||
{
|
||||
if ( !m_manager )
|
||||
return wxNOT_FOUND;
|
||||
return m_manager->GetPageByState(this);
|
||||
return m_manager ? m_manager->GetPageByState(this) : wxNOT_FOUND;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1470,10 +1470,7 @@ public:
|
|||
// Returns editor used for given column. NULL for no editor.
|
||||
const wxPGEditor* GetColumnEditor( int column ) const
|
||||
{
|
||||
if ( column == 1 )
|
||||
return GetEditorClass();
|
||||
|
||||
return NULL;
|
||||
return column == 1 ? GetEditorClass() : NULL;
|
||||
}
|
||||
|
||||
// Returns common value selected for this property. -1 for none.
|
||||
|
|
@ -1776,9 +1773,7 @@ public:
|
|||
// Gets assignable version of property's validator.
|
||||
wxValidator* GetValidator() const
|
||||
{
|
||||
if ( m_validator )
|
||||
return m_validator;
|
||||
return DoGetValidator();
|
||||
return m_validator ? m_validator : DoGetValidator();
|
||||
}
|
||||
#endif // wxUSE_VALIDATORS
|
||||
|
||||
|
|
|
|||
|
|
@ -2085,9 +2085,7 @@ public:
|
|||
// the property grid has been deleted.
|
||||
wxVariant GetPropertyValue() const
|
||||
{
|
||||
if ( m_validationInfo )
|
||||
return m_validationInfo->GetValue();
|
||||
return m_value;
|
||||
return m_validationInfo ? m_validationInfo->GetValue() : m_value;
|
||||
}
|
||||
|
||||
// Returns value of the associated property.
|
||||
|
|
|
|||
|
|
@ -828,9 +828,8 @@ public:
|
|||
void SetPropertyValues( const wxVariantList& list,
|
||||
wxPGPropArg defaultCategory = wxNullProperty )
|
||||
{
|
||||
wxPGProperty *p;
|
||||
if ( defaultCategory.HasName() ) p = defaultCategory.GetPtr(this);
|
||||
else p = defaultCategory.GetPtr0();
|
||||
wxPGProperty* p = defaultCategory.HasName() ?
|
||||
defaultCategory.GetPtr(this) : defaultCategory.GetPtr0();
|
||||
m_pState->DoSetPropertyValues(list, p);
|
||||
}
|
||||
|
||||
|
|
@ -1068,9 +1067,7 @@ protected:
|
|||
// Returns page state data for given (sub) page (-1 means current page).
|
||||
virtual wxPropertyGridPageState* GetPageState( int pageIndex ) const
|
||||
{
|
||||
if ( pageIndex <= 0 )
|
||||
return m_pState;
|
||||
return NULL;
|
||||
return pageIndex <= 0 ? m_pState : NULL;
|
||||
}
|
||||
|
||||
virtual bool DoSelectPage( int WXUNUSED(index) ) { return true; }
|
||||
|
|
@ -1094,18 +1091,13 @@ private:
|
|||
// Cannot be GetGrid() due to ambiguity issues.
|
||||
wxPropertyGrid* GetPropertyGrid()
|
||||
{
|
||||
if ( !m_pState )
|
||||
return NULL;
|
||||
return m_pState->GetGrid();
|
||||
return m_pState ? m_pState->GetGrid() : NULL;
|
||||
}
|
||||
|
||||
// Cannot be GetGrid() due to ambiguity issues.
|
||||
const wxPropertyGrid* GetPropertyGrid() const
|
||||
{
|
||||
if ( !m_pState )
|
||||
return NULL;
|
||||
|
||||
return m_pState->GetGrid();
|
||||
return m_pState ? m_pState->GetGrid() : NULL;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -479,11 +479,8 @@ wxPGProperty* wxPropertyGridPageState::BaseGetPropertyByLabel
|
|||
|
||||
wxPGProperty* wxPropertyGridPageState::BaseGetPropertyByName( const wxString& name ) const
|
||||
{
|
||||
wxPGHashMapS2P::const_iterator it;
|
||||
it = m_dictName.find(name);
|
||||
if ( it != m_dictName.end() )
|
||||
return (wxPGProperty*) it->second;
|
||||
return NULL;
|
||||
wxPGHashMapS2P::const_iterator it = m_dictName.find(name);
|
||||
return it != m_dictName.end() ? (wxPGProperty*) it->second : NULL;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue