KiCad PCB EDA Suite
|
Heuristically increment a string's n'th part from the right. More...
#include <increment.h>
Public Member Functions | |
void | SetSkipIOSQXZ (bool aSkip) |
If a alphabetic part is found, skip the letters I, O, S, Q, X, Z. | |
void | SetAlphabeticMaxIndex (int aMaxIndex) |
Set the maximum index for alphabetic parts. | |
std::optional< wxString > | Increment (const wxString &aStr, int aDelta, size_t aRightIndex) const |
Increment the n-th part from the right of the given string. | |
Private Types | |
enum class | STRING_PART_TYPE { ALPHABETIC , INTEGER , SKIP } |
Private Member Functions | |
bool | incrementPart (wxString &aPart, STRING_PART_TYPE aType, int aDelta) const |
Private Attributes | |
bool | m_SkipIOSQXZ = true |
int | m_AlphabeticMaxIndex = 50 |
Heuristically increment a string's n'th part from the right.
For example: incrementing the 0th part of A1 -> A2 1st part of A1 -> B1
This is a bit subjective as to what represents suitable "incrementable" parts, but it tries to be smart about it.
Definition at line 47 of file increment.h.
|
strongprivate |
Enumerator | |
---|---|
ALPHABETIC | |
INTEGER | |
SKIP |
Definition at line 74 of file increment.h.
std::optional< wxString > STRING_INCREMENTER::Increment | ( | const wxString & | aStr, |
int | aDelta, | ||
size_t | aRightIndex | ||
) | const |
Increment the n-th part from the right of the given string.
Definition at line 85 of file increment.cpp.
References ALPHABETIC, incrementPart(), INTEGER, and SKIP.
Referenced by BOOST_AUTO_TEST_CASE(), SCH_EDIT_TOOL::Increment(), and SYMBOL_EDITOR_EDIT_TOOL::Increment().
|
private |
Definition at line 162 of file increment.cpp.
References ALPHABETIC, AlphabeticFromIndex(), containsIOSQXZ(), IndexFromAlphabetic(), INTEGER, m_AlphabeticMaxIndex, m_SkipIOSQXZ, and SKIP.
Referenced by Increment().
|
inline |
Set the maximum index for alphabetic parts.
This means that if the index is greater than this, it will be treated as un-incrementable. This is to avoid incrementing things like "TX" or "CAN", which would be indexes of hundreds (unlikely to be a BGA row prefix, for example).
Setting < 0 disables the check (no limit)
Definition at line 66 of file increment.h.
|
inline |
If a alphabetic part is found, skip the letters I, O, S, Q, X, Z.
(if one is already there, increment it anyway).
Definition at line 54 of file increment.h.
Referenced by BOOST_AUTO_TEST_CASE(), SCH_EDIT_TOOL::Increment(), SYMBOL_EDITOR_EDIT_TOOL::Increment(), and EDIT_TOOL::Increment().
|
private |
Definition at line 84 of file increment.h.
Referenced by incrementPart().
|
private |
Definition at line 83 of file increment.h.
Referenced by incrementPart().