Repository navigation
Add simple runtime version check API - #970
Conversation
|
Why has the label "taglib2" been applied to this PR? These changes were intended for version 1. |
|
I removed the label "taglib2", since such a feature would not break binary compatibility. The reasoning was that it might be not so useful when introduced in a late 1.x version. What I do not like about the suggested solution is that it covers exactly one use case, namely "is version at least". What if someone wants to know the exact version? So I would suggest a simpler API: Either a simple |
|
I initially only provided that one use case because:
A while after I created this PR I checked out the taglib2 branch and discovered that it already has some support for getting the version numbers. Could this be reused? However I am not in favor of returning the TagLib version as one big number, it seems an inconvenient API to use. Suppose one wants to check if the version is 1.11.1 this way:
What do you think about extending the existing code from this PR to something like this: Or alternatively, returning the version as an object would be a nice solution, although it may seem a bit overkill. |
How to use:
#include <taglib.h>
if (TagLib::isTagLibVersionAtLeast(1, 11, 1)) {
// running v1.11.1 or higher
}
if (TagLib::isTagLibVersionAtLeast(1, 12)) {
// running v1.12 or higher
}
How to use:
#include "taglib.h"
if (TagLib::runtimeVersion() >= TagLib::VersionNumber(1, 11, 1)) {
// running v1.11.1 or higher
}
if (TagLib::runtimeVersion() >= TagLib::VersionNumber(1, 12)) {
// running v1.12 or higher"
}
23741c8 to
deac381
Compare
|
Looks good to me. It may be useful to also provide utility functions for converting a |
|
It is probably better to move the version number stuff into its own file. I have done this and also added a |
f22a844 to
2d877a3
Compare
|
I have updated the example usage in the description of this PR. For clarity I kept the code as similar as possible to the original, so the version numbers used (1.11.1 and 1.12) don't make much sense anymore, as the code will never be run on version 1.x. |
This adds a simple runtime version check as requested in #920 .
How to use:
EDIT: after the changes by @ufleisch this has become:
Fixes #920