[Development] Adding support for version number comparisons

André Somers andre at familiesomers.nl
Wed May 14 09:41:23 CEST 2014


Keith Gardner schreef op 13-5-2014 22:31:
>
>     imo, the cases which are fully under the user's control (internal
>     version checking) should be handled solely numerically (even without
>     considering any pre-releases), which basically means a minimalistic
>     semver(-like) implementation which can be fully inline (or even just a
>     collection of macros). in this segment, it is entirely unreasonable to
>     try to support existing users with bizarre versioning schemes, because
>     they most likely already have their own solutions. and new users
>     can be
>     told to use the straight-forward system.
>
> With that perspective, we can accomplish that now by just dropping the 
> suffix, which was what my initial proposal for QVersion was.  The 
> request to include suffix information came from the reviewers and this 
> mailing list.
I think that makes sense, but it would be nice if it would be easy for 
the user of the class to extend the version checking himself for 
non-numerical sections of the version string. That could be done in 
several ways I think, for instance with an API like this:

QVersion
{
...
protected:
     virtual bool isNonNumericalSectionLessThan(int section, QStringRef 
sectionString) const;
...
}

The default implementation would simply return false and thus not try to 
do any sorting.

That or another method to accomplish the same makes it easy to use the 
class for basic version numbers, while still be flexible enough for 
users to handle their own systems for pre and postfixes, right?

André

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140514/34e10ddd/attachment.html>


More information about the Development mailing list