7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-14 13:09:35 +00:00

Simplify LSEQ

Remove unneeded operators and index
This commit is contained in:
Seth Hillbrand 2024-07-16 14:48:33 -07:00
parent b38357a5ea
commit c093fe1355
4 changed files with 6 additions and 17 deletions

View File

@ -45,31 +45,20 @@ typedef std::vector<PCB_LAYER_ID> BASE_SEQ;
*/
class KICOMMON_API LSEQ : public BASE_SEQ
{
unsigned m_index;
public:
LSEQ() :
m_index( 0 )
LSEQ()
{}
template <class InputIterator>
LSEQ( InputIterator aStart, InputIterator aEnd ) :
BASE_SEQ( aStart, aEnd ), m_index( 0 )
BASE_SEQ( aStart, aEnd )
{}
LSEQ( std::initializer_list<PCB_LAYER_ID> aLayers ) :
BASE_SEQ( aLayers ), m_index( 0 )
BASE_SEQ( aLayers )
{}
operator bool () { return m_index < size(); }
PCB_LAYER_ID operator * () const
{
return at( m_index ); // throws std::out_of_range
}
int TestLayers( PCB_LAYER_ID aRhs, PCB_LAYER_ID aLhs ) const;
};

View File

@ -1990,7 +1990,7 @@ std::vector<PCB_SHAPE*> PAD::Recombine( bool aIsDryRun, int maxError )
else if( IsOnLayer( B_Cu ) )
layer = B_Cu;
else
layer = *GetLayerSet().UIOrder();
layer = GetLayerSet().UIOrder().front();
// If there are intersecting items to combine, we need to first make sure the pad is a
// custom-shape pad.

View File

@ -667,7 +667,7 @@ int PCBNEW_JOBS_HANDLER::JobExportGerbers( JOB* aJob )
else
{
// default to the board enabled layers
if( aGerberJob->m_printMaskLayer == 0 )
if( aGerberJob->m_printMaskLayer.empty() )
aGerberJob->m_printMaskLayer = brd->GetEnabledLayers().SeqStackupForPlotting();
if( aGerberJob->m_layersIncludeOnAllSet )

View File

@ -812,7 +812,7 @@ void PAD_TOOL::explodePad( PAD* aPad, PCB_LAYER_ID* aLayer, BOARD_COMMIT& aCommi
else if( aPad->IsOnLayer( B_Cu ) )
*aLayer = B_Cu;
else
*aLayer = *aPad->GetLayerSet().UIOrder();
*aLayer = aPad->GetLayerSet().UIOrder().front();
if( aPad->GetShape() == PAD_SHAPE::CUSTOM )
{