Variant.compare

Compares @one and @two.

The types of @one and @two are #gconstpointer only to allow use of this function with #GTree, #GPtrArray, etc. They must each be a #GVariant.

Comparison is only defined for basic types (ie: booleans, numbers, strings). For booleans, %FALSE is less than %TRUE. Numbers are ordered in the usual way. Strings are in ASCII lexographical order.

It is a programmer error to attempt to compare container values or two values that have types that are not exactly equal. For example, you cannot compare a 32-bit signed integer with a 32-bit unsigned integer. Also note that this function is not particularly well-behaved when it comes to comparison of doubles; in particular, the handling of incomparable values (ie: NaN) is undefined.

If you only require an equality comparison, g_variant_equal() is more general.

class Variant
int
compare

Parameters

two Variant

a #GVariant instance of the same type

Return Value

Type: int

negative value if a < b; zero if a = b; positive value if a > b.

Meta

Since

2.26