as-vercmp

as-vercmp — Version comparison functions.

Functions

Types and Values

Includes

#include <appstream.h>

Description

Compare software version numbers.

Functions

as_vercmp ()

gint
as_vercmp (const gchar *a,
           const gchar *b,
           AsVercmpFlags flags);

Compare alpha and numeric segments of two software versions, considering flags .

Parameters

a

First version number

 

b

Second version number

 

flags

Flags, e.g. AS_VERCMP_FLAG_NONE

 

Returns

>>0 if a is newer than b; 0 if a and b are the same version; <<0 if b is newer than a

as_vercmp_simple ()

gint
as_vercmp_simple (const gchar *a,
                  const gchar *b);

Compare alpha and numeric segments of two software versions.

Parameters

a

First version number

 

b

Second version number

 

Returns

>>0 if a is newer than b; 0 if a and b are the same version; <<0 if b is newer than a

as_vercmp_test_match ()

gboolean
as_vercmp_test_match (const gchar *ver1,
                      AsRelationCompare compare,
                      const gchar *ver2,
                      AsVercmpFlags flags);

Compare two version numbers and check if the given version comparator matches.

Parameters

ver1

first version number

 

compare

the comparison operator

 

ver2

second version number

 

flags

the AsVercmpFlags to use

 

Returns

TRUE if the version comparison matches, FALSE otherwise.

Since: 0.16.0

Types and Values

enum AsVercmpFlags

The flags used when matching unique IDs.

Members

AS_VERCMP_FLAG_NONE

No flags set

 

AS_VERCMP_FLAG_IGNORE_EPOCH

Ignore epoch part of a version string.