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

@@ -1448,7 +1448,7 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, int flags )
// GetPropertyByNameWH(). This optimizes for full list parsing.
for ( node = list.begin(); node != list.end(); ++node )
{
wxVariant& childValue = *((wxVariant*)*node);
wxVariant& childValue = *const_cast<wxVariant*>(*node);
wxPGProperty* child = GetPropertyByNameWH(childValue.GetName(), i);
if ( child )
{
@@ -2248,8 +2248,8 @@ void wxPGProperty::SetValueImage( wxBitmap& bmp )
wxPGProperty* wxPGProperty::GetMainParent() const
{
const wxPGProperty* curChild = this;
const wxPGProperty* curParent = m_parent;
wxPGProperty* curChild = const_cast<wxPGProperty*>(this);
wxPGProperty* curParent = m_parent;
while ( !curParent->IsRoot() && !curParent->IsCategory() )
{
@@ -2257,7 +2257,7 @@ wxPGProperty* wxPGProperty::GetMainParent() const
curParent = curParent->m_parent;
}
return (wxPGProperty*) curChild;
return curChild;
}
@@ -2729,7 +2729,7 @@ bool wxPGProperty::AreAllChildrenSpecified( wxVariant* pendingList ) const
for ( ; node != pList->end(); ++node )
{
const wxVariant& item = *((const wxVariant*)*node);
const wxVariant& item = *const_cast<const wxVariant*>(*node);
if ( item.GetName() == childName )
{
listValue = &item;
@@ -2753,7 +2753,7 @@ bool wxPGProperty::AreAllChildrenSpecified( wxVariant* pendingList ) const
if ( listValue && listValue->IsType(wxPG_VARIANT_TYPE_LIST) )
childList = listValue;
if ( !child->AreAllChildrenSpecified((wxVariant*)childList) )
if ( !child->AreAllChildrenSpecified(const_cast<wxVariant*>(childList)) )
return false;
}
}

View File

@@ -2128,7 +2128,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
if ( !p->HasFlag(wxPG_PROP_HIDDEN) )
{
visPropArray.push_back((wxPGProperty*)p);
visPropArray.push_back(const_cast<wxPGProperty*>(p));
if ( y > endScanBottomY )
break;

View File

@@ -1442,7 +1442,7 @@ void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList& list, wx
// Second pass for special entries
for ( node = list.begin(); node != list.end(); ++node )
{
wxVariant *current = (wxVariant*)*node;
wxVariant *current = const_cast<wxVariant*>(*node);
// Make sure it is wxVariant.
wxASSERT( current );
@@ -1505,7 +1505,7 @@ void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList& list, wx
{
for ( node = list.begin(); node != list.end(); ++node )
{
wxVariant *current = (wxVariant*)*node;
wxVariant *current = const_cast<wxVariant*>(*node);
const wxString& name = current->GetName();
if ( !name.empty() )
@@ -1536,7 +1536,7 @@ void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList& list, wx
for ( node2 = list2.begin(); node2 != list2.end(); ++node2 )
{
wxVariant *attr = (wxVariant*)*node2;
wxVariant *attr = const_cast<wxVariant*>(*node2);
foundProp->SetAttribute( attr->GetName(), *attr );
}
}