[Development] Adding support for version number comparisons

Keith Gardner kreios4004 at gmail.com
Wed May 14 14:28:03 CEST 2014


>
>
> 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?
>

Are you envisioning the overload to be passed as a parameter to the compare
function or have it be stored as a static variable so it only needs to be
set once?

As for prefixes, I have not come across a project that reports its version
with a prefix.  If we were to support prefixes, I would say that there
would have to be more restrictions on their format in order to support
converting from a QString to a QVersion.  The biggest restriction I can
think of is to not support numbers in the prefix string to remove
ambiguity.  Also, if there are no numerical values, would the string be
considered a prefix or suffix?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140514/c6565027/attachment.html>


More information about the Development mailing list