Use const_cast to change the constness

This commit is contained in:
Artur Wieczorek
2019-06-16 17:09:23 +02:00
parent 2ebdfb7a40
commit b064608c2a
9 changed files with 20 additions and 20 deletions

View File

@@ -460,7 +460,7 @@ public:
wxWindow* GetButton( unsigned int i ) { return m_buttons[i]; }
const wxWindow* GetButton( unsigned int i ) const
{ return (const wxWindow*) m_buttons[i]; }
{ return const_cast<const wxWindow*>(m_buttons[i]); }
// Utility function to be used in event handlers.
int GetButtonId( unsigned int i ) const { return GetButton(i)->GetId(); }

View File

@@ -270,7 +270,7 @@ public:
const wxPropertyGrid* GetGrid() const
{
wxASSERT(m_pPropGrid);
return (const wxPropertyGrid*)m_pPropGrid;
return const_cast<const wxPropertyGrid*>(m_pPropGrid);
}
// Returns iterator class instance.

View File

@@ -1162,7 +1162,7 @@ public:
const wxPGCommonValue* GetCommonValue( unsigned int i ) const
{
return (wxPGCommonValue*) m_commonValues[i];
return const_cast<const wxPGCommonValue*>(m_commonValues[i]);
}
// Returns number of common values.

View File

@@ -75,7 +75,7 @@ public:
wxPGProperty* GetPtr( wxPropertyGridInterface* iface ) const;
wxPGProperty* GetPtr( const wxPropertyGridInterface* iface ) const
{
return GetPtr((wxPropertyGridInterface*)iface);
return GetPtr(const_cast<wxPropertyGridInterface*>(iface));
}
wxPGProperty* GetPtr0() const { return m_ptr.property; }
bool HasName() const { return (m_flags != IsProperty); }
@@ -305,7 +305,7 @@ public:
const wxPGProperty* GetFirst( int flags = wxPG_ITERATE_ALL ) const
{
return ((wxPropertyGridInterface*)this)->GetFirst(flags);
return const_cast<const wxPGProperty*>(GetFirst(flags));
}
// Returns pointer to a property with given name (case-sensitive).

View File

@@ -217,12 +217,12 @@ public:
PROPERTY* property = NULL, int dir = 1)
: wxPropertyGridIteratorBase()
{
Init((wxPropertyGridPageState*)state, flags, (wxPGProperty*)property, dir);
Init(const_cast<wxPropertyGridPageState*>(state), flags, const_cast<wxPGProperty*>(property), dir);
}
wxPGIterator(STATE* state, int flags, int startPos, int dir = 0)
: wxPropertyGridIteratorBase()
{
Init((wxPropertyGridPageState*)state, flags, startPos, dir);
Init(const_cast<wxPropertyGridPageState*>(state), flags, startPos, dir);
}
wxPGIterator()
: wxPropertyGridIteratorBase()
@@ -248,7 +248,7 @@ public:
wxPGIterator operator++(int) { wxPGIterator it = *this; Next(); return it; }
wxPGIterator& operator--() { Prev(); return *this; }
wxPGIterator operator--(int) { wxPGIterator it = *this; Prev(); return it; }
PROPERTY* operator *() const { return (PROPERTY*)m_property; }
PROPERTY* operator *() const { return const_cast<PROPERTY*>(m_property); }
static PROPERTY* OneStep(STATE* state, int flags = wxPG_ITERATE_DEFAULT,
PROPERTY* property = NULL, int dir = 1)
{
@@ -412,7 +412,7 @@ public:
const wxPGProperty* GetLastItem( int flags = wxPG_ITERATE_DEFAULT ) const
{
return ((wxPropertyGridPageState*)this)->GetLastItem(flags);
return const_cast<const wxPGProperty*>(GetLastItem(flags));
}
// Returns currently selected property.

View File

@@ -771,7 +771,7 @@ bool PROPNAME::OnEvent( wxPropertyGrid* propgrid, \
wxWindow* primary, wxEvent& event ) \
{ \
if ( event.GetEventType() == wxEVT_BUTTON ) \
return OnButtonClick(propgrid,primary,(const wxChar*) CUSTBUTTXT); \
return OnButtonClick(propgrid,primary, const_cast<const wxChar*>(CUSTBUTTXT)); \
return false; \
}