/* * 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 gio.DatagramBasedT; public import gio.Cancellable; public import gio.c.functions; public import gio.c.types; public import glib.ErrorG; public import glib.GException; public import glib.Source; /** * Interface for socket-like objects with datagram semantics. * * Since: 2.48 */ public template DatagramBasedT(TStruct) { /** Get the main Gtk struct */ public GDatagramBased* getDatagramBasedStruct(bool transferOwnership = false) { if (transferOwnership) ownedRef = false; return cast(GDatagramBased*)getStruct(); } /** */ public GIOCondition conditionCheck(GIOCondition condition) { return g_datagram_based_condition_check(getDatagramBasedStruct(), condition); } /** */ public bool conditionWait(GIOCondition condition, long timeout, Cancellable cancellable) { GError* err = null; auto p = g_datagram_based_condition_wait(getDatagramBasedStruct(), condition, timeout, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0; if (err !is null) { throw new GException( new ErrorG(err) ); } return p; } /** */ public Source createSource(GIOCondition condition, Cancellable cancellable) { auto p = g_datagram_based_create_source(getDatagramBasedStruct(), condition, (cancellable is null) ? null : cancellable.getCancellableStruct()); if(p is null) { return null; } return new Source(cast(GSource*) p, true); } /** */ public int receiveMessages(GInputMessage* messages, uint numMessages, int flags, long timeout, Cancellable cancellable) { GError* err = null; auto p = g_datagram_based_receive_messages(getDatagramBasedStruct(), messages, numMessages, flags, timeout, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); if (err !is null) { throw new GException( new ErrorG(err) ); } return p; } /** */ public int sendMessages(GOutputMessage* messages, uint numMessages, int flags, long timeout, Cancellable cancellable) { GError* err = null; auto p = g_datagram_based_send_messages(getDatagramBasedStruct(), messages, numMessages, flags, timeout, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); if (err !is null) { throw new GException( new ErrorG(err) ); } return p; } }