/* * 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.Provided; private import appstream.c.functions; public import appstream.c.types; private import glib.ConstructionException; private import glib.PtrArray; private import glib.Str; private import gobject.ObjectG; /** */ public class Provided : ObjectG { /** the main Gtk struct */ protected AsProvided* asProvided; /** Get the main Gtk struct */ public AsProvided* getProvidedStruct(bool transferOwnership = false) { if (transferOwnership) ownedRef = false; return asProvided; } /** the main Gtk struct as a void* */ protected override void* getStruct() { return cast(void*)asProvided; } protected override void setStruct(GObject* obj) { asProvided = cast(AsProvided*)obj; super.setStruct(obj); } /** * Sets our main struct and passes it to the parent class. */ public this (AsProvided* asProvided, bool ownedRef = false) { this.asProvided = asProvided; super(cast(GObject*)asProvided, ownedRef); } /** */ public static GType getType() { return as_provided_get_type(); } /** * Creates a new #AsProvided. * * Returns: a #AsProvided * * Throws: ConstructionException GTK+ fails to create the object. */ public this() { auto p = as_provided_new(); if(p is null) { throw new ConstructionException("null returned by new"); } this(cast(AsProvided*) p, true); } /** * Converts the text representation to an enumerated value. * * Params: * kindStr = the string. * * Returns: a #AsProvidedKind or %AS_PROVIDED_KIND_UNKNOWN for unknown */ public static AsProvidedKind kindFromString(string kindStr) { return as_provided_kind_from_string(Str.toStringz(kindStr)); } /** * Converts the enumerated value to a localized text representation, * using the plural forms (e.g. "Libraries" instead of "Library"). * * This can be useful when displaying provided items in GUI dialogs. * * Params: * kind = the #AsProvidedKind. * * Returns: Pluralized, l10n string version of @kind */ public static string kindToL10nString(AsProvidedKind kind) { return Str.toString(as_provided_kind_to_l10n_string(kind)); } /** * Converts the enumerated value to a text representation. * * Params: * kind = the #AsProvidedKind. * * Returns: string version of @kind */ public static string kindToString(AsProvidedKind kind) { return Str.toString(as_provided_kind_to_string(kind)); } /** * Add a new provided item. */ public void addItem(string item) { as_provided_add_item(asProvided, Str.toStringz(item)); } /** * Get an array of provided data. * * Returns: An string list of provided items. */ public PtrArray getItems() { auto p = as_provided_get_items(asProvided); if(p is null) { return null; } return new PtrArray(cast(GPtrArray*) p); } /** * The kind of items this #AsProvided object stores. * * Returns: an enum of type #AsProvidedKind */ public AsProvidedKind getKind() { return as_provided_get_kind(asProvided); } /** * Check if the current #AsProvided contains an item * of the given name. * * Params: * item = the name of a provided item, e.g. "audio/x-vorbis" (in case the provided kind is a mimetype) * * Returns: %TRUE if found. */ public bool hasItem(string item) { return as_provided_has_item(asProvided, Str.toStringz(item)) != 0; } /** * Set the kind of items this #AsProvided object stores. * * Params: * kind = the new #AsProvidedKind */ public void setKind(AsProvidedKind kind) { as_provided_set_kind(asProvided, kind); } }