Break out ref-des-centric functions to own header
This breaks the following functions out to a general-purposed refdes utils header: * MODULE::GetReferencePrefix() * kicad_string.h RefDesStringCompare() This acheives: * Slimming of MODULE interface * Placement of refdes code in common rather than pcbnew ** Testing of this code in qa_common * Tighter and smaller includes for code that only needed refdes functions Note: there are failing tests commited (as expected failures). These are the cause of lp:1813669 and will be fixed as a follow-up commit.
This commit is contained in:
committed by
Seth Hillbrand
parent
dc20521cb9
commit
88f9f6f072
@@ -539,47 +539,6 @@ int ValueStringCompare( wxString strFWord, wxString strSWord )
|
||||
}
|
||||
|
||||
|
||||
int RefDesStringCompare( wxString strFWord, wxString strSWord )
|
||||
{
|
||||
// Compare unescaped text
|
||||
strFWord = UnescapeString( strFWord );
|
||||
strSWord = UnescapeString( strSWord );
|
||||
|
||||
// The different sections of the two strings
|
||||
wxString strFWordBeg, strFWordMid, strFWordEnd;
|
||||
wxString strSWordBeg, strSWordMid, strSWordEnd;
|
||||
|
||||
// Split the two strings into separate parts
|
||||
SplitString( strFWord, &strFWordBeg, &strFWordMid, &strFWordEnd );
|
||||
SplitString( strSWord, &strSWordBeg, &strSWordMid, &strSWordEnd );
|
||||
|
||||
// Compare the Beginning section of the strings
|
||||
int isEqual = strFWordBeg.CmpNoCase( strSWordBeg );
|
||||
|
||||
if( isEqual > 0 )
|
||||
return 1;
|
||||
else if( isEqual < 0 )
|
||||
return -1;
|
||||
else
|
||||
{
|
||||
// If the first sections are equal compare their digits
|
||||
long lFirstDigit = 0;
|
||||
long lSecondDigit = 0;
|
||||
|
||||
strFWordMid.ToLong( &lFirstDigit );
|
||||
strSWordMid.ToLong( &lSecondDigit );
|
||||
|
||||
if( lFirstDigit > lSecondDigit )
|
||||
return 1;
|
||||
else if( lFirstDigit < lSecondDigit )
|
||||
return -1;
|
||||
// If the first two sections are equal compare the endings
|
||||
else
|
||||
return strFWordEnd.CmpNoCase( strSWordEnd );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int SplitString( wxString strToSplit,
|
||||
wxString* strBeginning,
|
||||
wxString* strDigits,
|
||||
|
||||
Reference in New Issue
Block a user