Remove a few const_cast
This commit is contained in:
parent
07635d2fc7
commit
dc02ec9758
|
@ -74,7 +74,7 @@ public:
|
|||
|
||||
try
|
||||
{
|
||||
m_symbol = const_cast< LIB_PART* >( m_sym_lib_table->LoadSymbol( m_lib_id ) );
|
||||
m_symbol = m_sym_lib_table->LoadSymbol( m_lib_id );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
|
|
|
@ -109,8 +109,7 @@ SCH_DRAW_PANEL::~SCH_DRAW_PANEL()
|
|||
void SCH_DRAW_PANEL::DisplayComponent( LIB_PART* aComponent )
|
||||
{
|
||||
GetView()->Clear();
|
||||
GetView()->DisplayComponent( const_cast<LIB_PART*>(aComponent) );
|
||||
|
||||
GetView()->DisplayComponent( aComponent );
|
||||
}
|
||||
|
||||
|
||||
|
@ -119,7 +118,7 @@ void SCH_DRAW_PANEL::DisplaySheet( SCH_SCREEN *aScreen )
|
|||
GetView()->Clear();
|
||||
|
||||
if( aScreen )
|
||||
GetView()->DisplaySheet( const_cast<SCH_SCREEN*>( aScreen ) );
|
||||
GetView()->DisplaySheet( aScreen );
|
||||
else
|
||||
GetView()->Cleanup();
|
||||
}
|
||||
|
|
|
@ -168,15 +168,14 @@ SCH_PAINTER::SCH_PAINTER( GAL* aGal ) :
|
|||
|
||||
bool SCH_PAINTER::Draw( const VIEW_ITEM *aItem, int aLayer )
|
||||
{
|
||||
auto item2 = dynamic_cast<const EDA_ITEM*>( aItem );
|
||||
auto item = const_cast<EDA_ITEM*>( item2 );
|
||||
const auto item = dynamic_cast<const EDA_ITEM*>( aItem );
|
||||
|
||||
if( !item2 )
|
||||
if( !item )
|
||||
return false;
|
||||
|
||||
#ifdef CONNECTIVITY_DEBUG
|
||||
|
||||
auto sch_item = dynamic_cast<SCH_ITEM*>( item );
|
||||
auto sch_item = dynamic_cast<const SCH_ITEM*>( item );
|
||||
auto conn = sch_item ? sch_item->Connection( *g_CurrentSheet ) : nullptr;
|
||||
|
||||
if( conn )
|
||||
|
|
|
@ -120,7 +120,7 @@ void SCH_SCREEN::DecRefCount()
|
|||
|
||||
bool SCH_SCREEN::HasItems( KICAD_T aItemType ) const
|
||||
{
|
||||
EE_RTREE::EE_TYPE sheets = const_cast<EE_RTREE&>( m_rtree ).OfType( aItemType );
|
||||
EE_RTREE::EE_TYPE sheets = m_rtree.OfType( aItemType );
|
||||
|
||||
return sheets.begin() != sheets.end();
|
||||
}
|
||||
|
|
|
@ -366,7 +366,7 @@ public:
|
|||
|
||||
const std::vector<SCH_SHEET_PIN*>& GetPins() const
|
||||
{
|
||||
return const_cast< std::vector<SCH_SHEET_PIN*>& >( m_pins );
|
||||
return m_pins;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -208,7 +208,7 @@ public:
|
|||
if( aIndex < size() )
|
||||
retv = at( aIndex );
|
||||
|
||||
return const_cast< SCH_SHEET* >( retv );
|
||||
return retv;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -84,7 +84,7 @@ public:
|
|||
/// Return a reference to the project this schematic is part of
|
||||
PROJECT& Prj() const
|
||||
{
|
||||
return *const_cast<PROJECT*>( m_project );
|
||||
return *m_project;
|
||||
}
|
||||
|
||||
void SetProject( PROJECT* aPrj );
|
||||
|
|
|
@ -283,11 +283,9 @@ public:
|
|||
aIndex += SegmentCount();
|
||||
|
||||
if( aIndex == (int)( m_points.size() - 1 ) && m_closed )
|
||||
return SEG( const_cast<VECTOR2I&>( m_points[aIndex] ),
|
||||
const_cast<VECTOR2I&>( m_points[0] ), aIndex );
|
||||
return SEG( m_points[aIndex], m_points[0], aIndex );
|
||||
else
|
||||
return SEG( const_cast<VECTOR2I&>( m_points[aIndex] ),
|
||||
const_cast<VECTOR2I&>( m_points[aIndex + 1] ), aIndex );
|
||||
return SEG( m_points[aIndex], m_points[aIndex + 1], aIndex );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -148,7 +148,7 @@ FOOTPRINT::FOOTPRINT( const FOOTPRINT& aFootprint ) :
|
|||
{
|
||||
PCB_GROUP* newGroup = static_cast<PCB_GROUP*>( ptrMap[ group ] );
|
||||
|
||||
const_cast<std::unordered_set<BOARD_ITEM*>*>( &newGroup->GetItems() )->clear();
|
||||
newGroup->GetItems().clear();
|
||||
|
||||
for( BOARD_ITEM* member : group->GetItems() )
|
||||
newGroup->AddItem( ptrMap[ member ] );
|
||||
|
|
|
@ -353,8 +353,8 @@ const ITEM_SET DIFF_PAIR_PLACER::Traces()
|
|||
{
|
||||
ITEM_SET t;
|
||||
|
||||
t.Add( const_cast<LINE*>( &m_currentTrace.PLine() ) );
|
||||
t.Add( const_cast<LINE*>( &m_currentTrace.NLine() ) );
|
||||
t.Add( &m_currentTrace.PLine() );
|
||||
t.Add( &m_currentTrace.NLine() );
|
||||
|
||||
return t;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue