diff options
-rw-r--r-- | libappstream-glib/as-content-rating.c | 24 | ||||
-rw-r--r-- | libappstream-glib/as-content-rating.h | 1 |
2 files changed, 25 insertions, 0 deletions
diff --git a/libappstream-glib/as-content-rating.c b/libappstream-glib/as-content-rating.c index 02fb3d0..059a625 100644 --- a/libappstream-glib/as-content-rating.c +++ b/libappstream-glib/as-content-rating.c @@ -293,6 +293,30 @@ as_content_rating_attribute_to_csm_age (const gchar *id, AsContentRatingValue va } /** + * as_content_rating_get_all_rating_ids: + * + * Returns a list of all the valid OARS content rating attribute IDs as could + * be passed to as_content_rating_add_attribute() or + * as_content_rating_attribute_to_csm_age(). + * + * Returns: (array zero-terminated=1) (transfer container): a %NULL-terminated + * array of IDs, to be freed with g_free() (the element values are owned by + * libappstream-glib and must not be freed) + * Since: 0.7.15 + */ +const gchar ** +as_content_rating_get_all_rating_ids (void) +{ + g_autofree const gchar **ids = NULL; + + ids = g_new0 (const gchar *, G_N_ELEMENTS (oars_to_csm_mappings) + 1 /* NULL terminator */); + for (gsize i = 0; i < G_N_ELEMENTS (oars_to_csm_mappings); i++) + ids[i] = oars_to_csm_mappings[i].id; + + return g_steal_pointer (&ids); +} + +/** * as_content_rating_get_minimum_age: * @content_rating: a #AsContentRating * diff --git a/libappstream-glib/as-content-rating.h b/libappstream-glib/as-content-rating.h index 8ba3d7c..f9bcb8b 100644 --- a/libappstream-glib/as-content-rating.h +++ b/libappstream-glib/as-content-rating.h @@ -86,6 +86,7 @@ const gchar **as_content_rating_get_rating_ids (AsContentRating *content_rating) guint as_content_rating_attribute_to_csm_age (const gchar *id, AsContentRatingValue value); +const gchar **as_content_rating_get_all_rating_ids (void); /* setters */ void as_content_rating_set_kind (AsContentRating *content_rating, |