Top | ![]() |
![]() |
![]() |
![]() |
gint | fu_common_vercmp_full () |
gchar * | fu_common_version_from_uint64 () |
gchar * | fu_common_version_from_uint32 () |
gchar * | fu_common_version_from_uint16 () |
gchar * | fu_common_version_parse_from_format () |
gchar * | fu_common_version_ensure_semver () |
gchar * | fu_common_version_ensure_semver_full () |
FwupdVersionFormat | fu_common_version_guess_format () |
gboolean | fu_common_version_verify_format () |
gint fu_common_vercmp_full (const gchar *version_a
,const gchar *version_b
,FwupdVersionFormat fmt
);
Compares version numbers for sorting taking into account the version format if required.
version_a |
the semver release version, e.g. |
[nullable] |
version_b |
the semver release version, e.g. |
[nullable] |
fmt |
a version format, e.g. |
Since: 1.3.9
gchar * fu_common_version_from_uint64 (guint64 val
,FwupdVersionFormat kind
);
Returns a dotted decimal version string from a 64 bit number.
val |
a raw version number |
|
kind |
version kind used for formatting, e.g. |
Since: 1.3.6
gchar * fu_common_version_from_uint32 (guint32 val
,FwupdVersionFormat kind
);
Returns a dotted decimal version string from a 32 bit number.
val |
a uint32le version number |
|
kind |
version kind used for formatting, e.g. |
Since: 1.2.0
gchar * fu_common_version_from_uint16 (guint16 val
,FwupdVersionFormat kind
);
Returns a dotted decimal version string from a 16 bit number.
val |
a uint16le version number |
|
kind |
version kind used for formatting, e.g. |
Since: 1.2.0
gchar * fu_common_version_parse_from_format (const gchar *version
,FwupdVersionFormat fmt
);
Returns a dotted decimal version string from a version string using fmt
.
The supported formats are:
Dotted decimal, e.g. 1.2.3
Base 16, a hex number *with* a 0x prefix, e.g. 0x10203
Base 10, a string containing just [0-9], e.g. 66051
Date in YYYYMMDD format, e.g. 20150915
Anything with a .
or that doesn't match [0-9]
or 0x[a-f,0-9]
is considered
a string and returned without modification.
version |
a version number. |
[nullable] |
fmt |
a version format, e.g. |
Since: 1.3.3
gchar *
fu_common_version_ensure_semver (const gchar *version
);
Builds a semver from the possibly crazy version number.
Since: 1.2.9
gchar * fu_common_version_ensure_semver_full (const gchar *version
,FwupdVersionFormat fmt
);
Builds a semver from the possibly crazy version number. Depending on the semver
value
the string will be split and a string in the correct format will be returned.
version |
a version number, e.g. |
[nullable] |
fmt |
a version format, e.g. |
Since: 1.7.6
FwupdVersionFormat
fu_common_version_guess_format (const gchar *version
);
Guesses the version format from the version number. This is only a heuristic and plugins and components should explicitly set the version format whenever possible.
If the version format cannot be guessed with any degree of accuracy, the
FWUPD_VERSION_FORMAT_UNKNOWN
constant is returned.
Since: 1.2.0
gboolean fu_common_version_verify_format (const gchar *version
,FwupdVersionFormat fmt
,GError **error
);
Verifies if a version matches the input format.
version |
a string, e.g. |
[not nullable] |
fmt |
a version format |
|
error |
optional return location for an error. |
[nullable] |
Since: 1.2.9