KiCad PCB EDA Suite
Loading...
Searching...
No Matches
increment.h File Reference
#include <optional>
#include <wx/string.h>
#include <kicommon.h>

Go to the source code of this file.

Classes

class  STRING_INCREMENTER
 Heuristically increment a string's n'th part from the right. More...
 

Functions

KICOMMON_API bool IncrementString (wxString &aStr, int aDelta)
 Generic string incrementer.
 
KICOMMON_API int IndexFromAlphabetic (const wxString &aStr, const wxString &aAlphabet)
 Attempt to convert a string to an integer, assuming it is an alphabetic string like "A", "B", ... "Z", "AA", "AB", ... "ZZ", "AAA", ... in some alphabet.
 
KICOMMON_API wxString AlphabeticFromIndex (size_t aN, const wxString &aAlphabet, bool aZeroBasedNonUnitCols)
 Get an alphabetic string like A, B, ... Z, AA, AB, ... ZZ, AAA, ...
 

Function Documentation

◆ AlphabeticFromIndex()

KICOMMON_API wxString AlphabeticFromIndex ( size_t  aN,
const wxString &  aAlphabet,
bool  aZeroBasedNonUnitCols 
)

Get an alphabetic string like A, B, ... Z, AA, AB, ... ZZ, AAA, ...

Parameters
aIndexThe index to convert.
aAlphabetThe alphabet to use.
aZeroBasedNonUnitColsIf true, cols other than the right most use the 0'th entry (e.g. Z -> AA, not BA, but 9 -> 10, not 00).

Definition at line 258 of file increment.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), ARRAY_AXIS::GetItemNumber(), and STRING_INCREMENTER::incrementPart().

◆ IncrementString()

KICOMMON_API bool IncrementString ( wxString &  aStr,
int  aDelta 
)

Generic string incrementer.

Definition at line 33 of file increment.cpp.

References name.

Referenced by SCH_LABEL_BASE::IncrementLabel(), and SYMBOL_EDITOR_PIN_TOOL::RepeatPin().

◆ IndexFromAlphabetic()

KICOMMON_API int IndexFromAlphabetic ( const wxString &  aStr,
const wxString &  aAlphabet 
)

Attempt to convert a string to an integer, assuming it is an alphabetic string like "A", "B", ... "Z", "AA", "AB", ... "ZZ", "AAA", ... in some alphabet.

Returns
The value of the string, or -1 if a character is not in the alphabet.

Definition at line 236 of file increment.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), and STRING_INCREMENTER::incrementPart().