mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-24 13:06:14 +01:00
boxed: Register GPatternSpec as boxed type
This commit is contained in:
parent
474ece6d61
commit
b8a9f4b436
@ -411,6 +411,7 @@ G_TYPE_THREAD
|
||||
G_TYPE_OPTION_GROUP
|
||||
G_TYPE_URI
|
||||
G_TYPE_TREE
|
||||
G_TYPE_PATTERN_SPEC
|
||||
|
||||
<SUBSECTION Standard>
|
||||
G_TYPE_IS_BOXED
|
||||
@ -446,6 +447,7 @@ g_thread_get_type
|
||||
g_option_group_get_type
|
||||
g_uri_get_type
|
||||
g_tree_get_type
|
||||
g_pattern_spec_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
|
@ -175,6 +175,7 @@ G_DEFINE_BOXED_TYPE (GChecksum, g_checksum, g_checksum_copy, g_checksum_free)
|
||||
G_DEFINE_BOXED_TYPE (GUri, g_uri, g_uri_ref, g_uri_unref)
|
||||
|
||||
G_DEFINE_BOXED_TYPE (GOptionGroup, g_option_group, g_option_group_ref, g_option_group_unref)
|
||||
G_DEFINE_BOXED_TYPE (GPatternSpec, g_pattern_spec, g_pattern_spec_copy, g_pattern_spec_free);
|
||||
|
||||
/* This one can't use G_DEFINE_BOXED_TYPE (GStrv, g_strv, g_strdupv, g_strfreev) */
|
||||
GType
|
||||
|
@ -315,6 +315,15 @@ typedef gsize GType;
|
||||
*/
|
||||
#define G_TYPE_TREE (g_tree_get_type ())
|
||||
|
||||
/**
|
||||
* G_TYPE_PATTERN_SPEC:
|
||||
*
|
||||
* The #GType for #GPatternSpec.
|
||||
*
|
||||
* Since: 2.70
|
||||
*/
|
||||
#define G_TYPE_PATTERN_SPEC (g_pattern_spec_get_type ())
|
||||
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
GType g_date_get_type (void) G_GNUC_CONST;
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
@ -375,6 +384,8 @@ GLIB_AVAILABLE_IN_2_66
|
||||
GType g_uri_get_type (void) G_GNUC_CONST;
|
||||
GLIB_AVAILABLE_IN_2_68
|
||||
GType g_tree_get_type (void) G_GNUC_CONST;
|
||||
GLIB_AVAILABLE_IN_2_70
|
||||
GType g_pattern_spec_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GLIB_DEPRECATED_FOR('G_TYPE_VARIANT')
|
||||
GType g_variant_get_gtype (void) G_GNUC_CONST;
|
||||
|
@ -645,6 +645,29 @@ test_boxed_tree (void)
|
||||
g_value_unset (&value);
|
||||
}
|
||||
|
||||
static void
|
||||
test_boxed_pattern_spec (void)
|
||||
{
|
||||
GPatternSpec *ps, *ps2;
|
||||
GValue value = G_VALUE_INIT;
|
||||
|
||||
g_value_init (&value, G_TYPE_PATTERN_SPEC);
|
||||
g_assert_true (G_VALUE_HOLDS_BOXED (&value));
|
||||
|
||||
ps = g_pattern_spec_new ("*abc*?cde");
|
||||
g_value_take_boxed (&value, ps);
|
||||
|
||||
ps2 = g_value_get_boxed (&value);
|
||||
g_assert_true (ps == ps2);
|
||||
|
||||
ps2 = g_value_dup_boxed (&value);
|
||||
g_assert_true (ps != ps2);
|
||||
g_assert_true (g_pattern_spec_equal (ps, ps2));
|
||||
g_pattern_spec_free (ps2);
|
||||
|
||||
g_value_unset (&value);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
@ -675,6 +698,7 @@ main (int argc, char *argv[])
|
||||
g_test_add_func ("/boxed/thread", test_boxed_thread);
|
||||
g_test_add_func ("/boxed/checksum", test_boxed_checksum);
|
||||
g_test_add_func ("/boxed/tree", test_boxed_tree);
|
||||
g_test_add_func ("/boxed/patternspec", test_boxed_pattern_spec);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user