Add some more cases to the app-id unit tests
[glib.git] / gio / gfiledescriptorbased.c
bloba0ae22241d30588039077b44248db6ab3ab5cbfc
1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright (C) 2010 Christian Kellner
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
18 * Author: Christian Kellner <gicmo@gnome.org>
21 #include "config.h"
22 #include "gfiledescriptorbased.h"
23 #include "glibintl.h"
26 /**
27 * SECTION:gfiledescriptorbased
28 * @short_description: Interface for file descriptor based IO
29 * @include: gio/gfiledescriptorbased.h
30 * @see_also: #GInputStream, #GOutputStream
32 * #GFileDescriptorBased is implemented by streams (implementations of
33 * #GInputStream or #GOutputStream) that are based on file descriptors.
35 * Note that `<gio/gfiledescriptorbased.h>` belongs to the UNIX-specific
36 * GIO interfaces, thus you have to use the `gio-unix-2.0.pc` pkg-config
37 * file when using it.
39 * Since: 2.24
41 **/
43 typedef GFileDescriptorBasedIface GFileDescriptorBasedInterface;
44 G_DEFINE_INTERFACE (GFileDescriptorBased, g_file_descriptor_based, G_TYPE_OBJECT)
46 static void
47 g_file_descriptor_based_default_init (GFileDescriptorBasedInterface *iface)
51 /**
52 * g_file_descriptor_based_get_fd:
53 * @fd_based: a #GFileDescriptorBased.
55 * Gets the underlying file descriptor.
57 * Returns: The file descriptor
59 * Since: 2.24
60 **/
61 int
62 g_file_descriptor_based_get_fd (GFileDescriptorBased *fd_based)
64 GFileDescriptorBasedIface *iface;
66 g_return_val_if_fail (G_IS_FILE_DESCRIPTOR_BASED (fd_based), 0);
68 iface = G_FILE_DESCRIPTOR_BASED_GET_IFACE (fd_based);
70 return (* iface->get_fd) (fd_based);