[Development] Adding support for version number comparisons
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:
> 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
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...
More information about the Development