/* * Licensed under the GNU Lesser General Public License Version 3 * * This library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the license, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library. If not, see . */ // generated automatically - do not change module appstream.ContentRating; private import appstream.c.functions; public import appstream.c.types; private import glib.ConstructionException; private import glib.Str; private import gobject.ObjectG; /** */ public class ContentRating : ObjectG { /** the main Gtk struct */ protected AsContentRating* asContentRating; /** Get the main Gtk struct */ public AsContentRating* getContentRatingStruct(bool transferOwnership = false) { if (transferOwnership) ownedRef = false; return asContentRating; } /** the main Gtk struct as a void* */ protected override void* getStruct() { return cast(void*)asContentRating; } protected override void setStruct(GObject* obj) { asContentRating = cast(AsContentRating*)obj; super.setStruct(obj); } /** * Sets our main struct and passes it to the parent class. */ public this (AsContentRating* asContentRating, bool ownedRef = false) { this.asContentRating = asContentRating; super(cast(GObject*)asContentRating, ownedRef); } /** */ public static GType getType() { return as_content_rating_get_type(); } /** * Creates a new #AsContentRating. * * Returns: a #AsContentRating * * Since: 0.5.12 * * Throws: ConstructionException GTK+ fails to create the object. */ public this() { auto p = as_content_rating_new(); if(p is null) { throw new ConstructionException("null returned by new"); } this(cast(AsContentRating*) p, true); } /** * Converts the text representation to an enumerated value. * * Params: * value = the string. * * Returns: a #AsContentRatingValue or %AS_CONTENT_RATING_VALUE_UNKNOWN for unknown * * Since: 0.11.0 */ public static AsContentRatingValue valueFromString(string value) { return as_content_rating_value_from_string(Str.toStringz(value)); } /** * Converts the enumerated value to an text representation. * * Params: * value = the #AsContentRatingValue. * * Returns: string version of @value * * Since: 0.11.0 */ public static string valueToString(AsContentRatingValue value) { return Str.toString(as_content_rating_value_to_string(value)); } /** * Gets the content_rating kind. * * Returns: a string, e.g. "oars-1.0", or NULL * * Since: 0.11.0 */ public string getKind() { return Str.toString(as_content_rating_get_kind(asContentRating)); } /** * Gets the lowest Common Sense Media approved age for the content_rating block. * NOTE: these numbers are based on the data and descriptions available from * https://www.commonsensemedia.org/about-us/our-mission/about-our-ratings and * you may disagree with them. * * You're free to disagree with these, and of course you should use your own * brain to work our if your child is able to cope with the concepts enumerated * here. Some 13 year olds mey be fine with the concept of mutilation of body * parts, others may get nightmares. * * Returns: The age in years, 0 for no rating, or G_MAXUINT for no details. * * Since: 0.11.0 */ public uint getMinimumAge() { return as_content_rating_get_minimum_age(asContentRating); } /** * Gets the value of a content rating key. * * Params: * id = A ratings ID, e.g. `violence-bloodshed`. * * Returns: the #AsContentRatingValue, or %AS_CONTENT_RATING_VALUE_UNKNOWN * * Since: 0.11.0 */ public AsContentRatingValue getValue(string id) { return as_content_rating_get_value(asContentRating, Str.toStringz(id)); } /** * Sets the content rating kind. * * Params: * kind = the rating kind, e.g. "oars-1.0" * * Since: 0.11.0 */ public void setKind(string kind) { as_content_rating_set_kind(asContentRating, Str.toStringz(kind)); } /** * Sets the value of a content rating key. * * Params: * id = A ratings ID, e.g. `violence-bloodshed`. * value = A #AsContentRatingValue, e.g. %AS_CONTENT_RATING_VALUE_INTENSE * * Since: 0.11.0 */ public void setValue(string id, AsContentRatingValue value) { as_content_rating_set_value(asContentRating, Str.toStringz(id), value); } }