KiCad PCB EDA Suite
Loading...
Searching...
No Matches
array_pad_number_provider.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.TXT for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
21
22#include <pad.h>
23
24
25ARRAY_PAD_NUMBER_PROVIDER::ARRAY_PAD_NUMBER_PROVIDER( const std::set<wxString>& aExistingPadNumbers,
26 const ARRAY_OPTIONS& aArrayOpts )
27 : m_arrayOpts( aArrayOpts )
28{
29 // start by numbering the first new item
31
32 // construct the set of existing pad numbers
33 if( aArrayOpts.GetNumberingStartIsSpecified() )
34 {
35 // if we start from a specified point, we don't look at existing
36 // names, so it's just an empty "reserved" set
37 }
38 else
39 {
40 m_existing_pad_numbers = aExistingPadNumbers;
41 }
42}
43
44
49
50
52 const std::set<wxString>& aExisting )
53{
54 wxString next_number;
55
56 do
57 {
58 next_number = m_arrayOpts.GetItemNumber( aIndex );
59 aIndex++;
60 } while( aExisting.count( next_number ) != 0 );
61
62 return next_number;
63}
Options that govern the setup of an "array" of multiple item.
bool GetNumberingStartIsSpecified() const
wxString getNextNumber(int &aIndex, const std::set< wxString > &aExisting)
Get the next number from a given index/list combo.
wxString GetNextPadNumber()
Get the next available pad name.
ARRAY_PAD_NUMBER_PROVIDER(const std::set< wxString > &aExistingPadNumbers, const ARRAY_OPTIONS &aArrayOpts)
std::set< wxString > m_existing_pad_numbers