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 86 of file increment.cpp.
References ALPHABETIC, incrementPart(), INTEGER, result, and SKIP.
Referenced by BOOST_AUTO_TEST_CASE(), and SCH_TOOL_BASE< T >::Increment().
|
private |
Definition at line 170 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.
References m_AlphabeticMaxIndex.
|
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.
References m_SkipIOSQXZ.
Referenced by BOOST_AUTO_TEST_CASE(), EDIT_TOOL::Increment(), and SCH_TOOL_BASE< T >::Increment().
|
private |
Definition at line 84 of file increment.h.
Referenced by incrementPart(), and SetAlphabeticMaxIndex().
|
private |
Definition at line 83 of file increment.h.
Referenced by incrementPart(), and SetSkipIOSQXZ().