KiCad PCB EDA Suite
Loading...
Searching...
No Matches
increment.cpp File Reference
#include "increment.h"
#include <wx/wxcrt.h>
#include <cmath>
#include <iostream>
#include <regex>

Go to the source code of this file.

Functions

KICOMMON_API bool IncrementString (wxString &name, int aIncrement)
 Generic string incrementer.
 
static bool containsIOSQXZ (const wxString &aStr)
 
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.
 
wxString KICOMMON_API AlphabeticFromIndex (size_t aN, const wxString &aAlphabet, bool aZeroBasedNonUnitCols)
 Get an alphabetic string like A, B, ... Z, AA, AB, ... ZZ, AAA, ...
 

Function Documentation

◆ AlphabeticFromIndex()

wxString KICOMMON_API 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().

◆ containsIOSQXZ()

static bool containsIOSQXZ ( const wxString &  aStr)
static

Definition at line 150 of file increment.cpp.

Referenced by STRING_INCREMENTER::incrementPart().

◆ IncrementString()

KICOMMON_API bool IncrementString ( wxString &  name,
int  aIncrement 
)

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().