51 static const wxString alphaNumeric = wxS(
"0123456789" );
52 static const wxString alphaHex = wxS(
"0123456789ABCDEF" );
53 static const wxString alphaFull = wxS(
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
54 static const wxString alphaNoIOSQXZ = wxS(
"ABCDEFGHJKLMNPRTUVWY" );
73 if( str.length() == 0 )
74 return std::optional<int>{};
79 const int radix = alphabet.length();
81 for(
unsigned i = 0; i < str.length(); i++ )
83 wxUniChar ch = str[i];
90 int chIndex = alphabet.Find( ch,
false );
92 if( chIndex == wxNOT_FOUND )
93 return std::optional<int>{};
98 if( start0 && i < str.length() - 1 )
105 return std::optional<int>{ offset };
127 wxUniChar firstChar = aOffsetName[0];
static bool schemeNonUnitColsStartAt0(ARRAY_AXIS::NUMBERING_TYPE type)
bool SetOffset(const wxString &aOffsetName)
Set the axis start (as a string, which should decode to a valid index in the alphabet),...
int m_step
Skip every 'n' numbers.
bool m_useLowercase
Output lowercase letters when true (for alphabetic types).
wxString GetItemNumber(int n) const
Get the position number (name) for the n'th axis point.
static bool TypeIsNumeric(NUMBERING_TYPE type)
Check if a numbering type is a numeric type.
const wxString & GetAlphabet() const
Get the alphabet for the current numbering scheme.
void SetAxisType(NUMBERING_TYPE aType)
Set the axis numbering type.
@ NUMBERING_NUMERIC
Arabic numerals: 0,1,2,3,4,5,6,7,8,9,10,11...
@ NUMBERING_ALPHA_NO_IOSQXZ
Alphabet, excluding IOSQXZ.
@ NUMBERING_ALPHA_FULL
Full 26-character alphabet.
std::optional< int > getNumberingOffset(const wxString &str) const
Get the numbering offset for a given numbering string.
void SetStep(int aStep)
Set the skip between consecutive numbers (useful when doing a partial array, e.g.
int GetOffset() const
Get the numbering offset for the axis.
wxString KICOMMON_API AlphabeticFromIndex(size_t aN, const wxString &aAlphabet, bool aZeroBasedNonUnitCols)
Get an alphabetic string like A, B, ... Z, AA, AB, ... ZZ, AAA, ...
wxString result
Test unit parsing edge cases and error handling.