KiCad PCB EDA Suite
Loading...
Searching...
No Matches
array_axis.h
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, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#ifndef ARRAY_AXIS__H
25#define ARRAY_AXIS__H
26
27#include <kicommon.h>
28#include <optional>
29
30#include <wx/string.h>
31
40{
41public:
43 {
44 NUMBERING_NUMERIC = 0,
46
55 };
56
60 static bool TypeIsNumeric( NUMBERING_TYPE type )
61 {
62 return type == NUMBERING_NUMERIC || type == NUMBERING_HEX;
63 };
64
65 ARRAY_AXIS();
66
72 const wxString& GetAlphabet() const;
73
77 void SetAxisType( NUMBERING_TYPE aType );
78
83 bool SetOffset( const wxString& aOffsetName );
84
91 void SetOffset( int aOffset );
92
98 int GetOffset() const;
99
104 void SetStep( int aStep );
105
112 wxString GetItemNumber( int n ) const;
113
114private:
121 std::optional<int> getNumberingOffset( const wxString& str ) const;
122
125
128};
129
130#endif // ARRAY_AXIS__H
Class that contains information about a single array axis and the numbering of items along that axis.
Definition: array_axis.h:40
int m_step
Skip every 'n' numbers.
Definition: array_axis.h:127
int m_offset
Definition: array_axis.h:124
NUMBERING_TYPE m_type
Definition: array_axis.h:123
static bool TypeIsNumeric(NUMBERING_TYPE type)
Check if a numbering type is a numeric type.
Definition: array_axis.h:60
@ NUMBERING_HEX
Definition: array_axis.h:45
@ NUMBERING_ALPHA_NO_IOSQXZ
Alphabet, excluding IOSQXZ.
Definition: array_axis.h:53
@ NUMBERING_ALPHA_FULL
Full 26-character alphabet.
Definition: array_axis.h:54
#define KICOMMON_API
Definition: kicommon.h:28