get_strv
Description:
Gets the contents of an array of strings Variant.
This call makes a shallow copy; the return result should be released with g_free, but the individual strings must not be modified.
If return.length
is non-null then the number of elements in
the result is stored there. In any case, the resulting array will be null-terminated.
For an empty array, return.length
will be set to 0 and a pointer to a
null pointer will be returned.
Example: Get a string array:
public static int main () {
Variant var1 = new Variant.strv ({"a", "b", "c"});
// Output: ``a,b,c``
print ("%s\n", string.joinv (",", var1.dup_strv ()));
// Output: ``a,b,c``
print ("%s\n", string.joinv (",", var1.get_strv ()));
// Output: ``a,b,c``
print ("%s\n", string.joinv (",", (string[]) var1));
return 0;
}
valac --pkg glib-2.0 GLib.Variant.get_strv.vala
Parameters:
this |
an array of strings Variant |
length |
the length of the result, or null |
Returns:
an array of constant strings |