← Back to team overview

kicad-developers team mailing list archive

Re: Bug #1752298: Clean up sorting functions for mixed text and numbers

 

Hi Pradeepa,

We already have a string comparison function that handles this.  Take a
look at StrNumCmp()[1] in common/string.cpp[2].  We use this function in
many places for mixed text and number comparisons so I see no reason not
to use it in this case unless there is a bug in StrNumCmp().

Cheers,

Wayne

[1]:
http://docs.kicad-pcb.org/doxygen/kicad__string_8h.html#a76901fb3f83511f8fbc2d60df2213b6c
[2]: https://git.launchpad.net/kicad/tree/common/string.cpp

On 6/30/2019 2:05 AM, Pradeepa Senanayake wrote:
> Hello All,
> 
> I started working on the bug #1752298 and I would like to get an
> understanding on the requirements. I feel that this is not a bug, rather
> it is a requirement to have a unified function for sorting.
> 
> There can be many requirements for sorting in KiCAD. Therefore, before
> jumping into implementation, I'd like to ask what requirements we are after.
> 
> One sorting mechanism can look like below.
> 
> A0, A1, A2, ...., B0, B1, B2.... C1, C2, C3, ... , AA1, AA2, ..., AB0,
> AB1, ... etc
> 
> This can possibly be used for pin sorting (PA0, PA1, etc.) and component
> sorting. (J1, J2, U1, U2, etc.)
> 
> Also, where do we usually store utility functions? Is there a particular
> namespace?
> 
> Thanks!
> Best Regards,
> Pradeepa Senanayake.
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 


Follow ups

References