mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-24 21:16:15 +01:00
GLocalFileInputStream: Implement GFileDescriptorBased
This commit is contained in:
parent
4536a4adbc
commit
670f6210ce
@ -33,6 +33,7 @@
|
||||
#include <glib.h>
|
||||
#include <glib/gstdio.h>
|
||||
#include "gcancellable.h"
|
||||
#include "gfiledescriptorbased.h"
|
||||
#include "gioerror.h"
|
||||
#include "glocalfileinputstream.h"
|
||||
#include "glocalfileinfo.h"
|
||||
@ -44,8 +45,12 @@
|
||||
|
||||
#include "gioalias.h"
|
||||
|
||||
|
||||
static void g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface);
|
||||
#define g_local_file_input_stream_get_type _g_local_file_input_stream_get_type
|
||||
G_DEFINE_TYPE (GLocalFileInputStream, g_local_file_input_stream, G_TYPE_FILE_INPUT_STREAM);
|
||||
G_DEFINE_TYPE_WITH_CODE (GLocalFileInputStream, g_local_file_input_stream, G_TYPE_FILE_INPUT_STREAM,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_FILE_DESCRIPTOR_BASED,
|
||||
g_file_descriptor_based_iface_init));
|
||||
|
||||
struct _GLocalFileInputStreamPrivate {
|
||||
int fd;
|
||||
@ -75,6 +80,7 @@ static GFileInfo *g_local_file_input_stream_query_info (GFileInputStream *strea
|
||||
const char *attributes,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
static int g_local_file_input_stream_get_fd (GFileDescriptorBased *stream);
|
||||
|
||||
static void
|
||||
g_local_file_input_stream_finalize (GObject *object)
|
||||
@ -109,6 +115,12 @@ g_local_file_input_stream_class_init (GLocalFileInputStreamClass *klass)
|
||||
file_stream_class->query_info = g_local_file_input_stream_query_info;
|
||||
}
|
||||
|
||||
static void
|
||||
g_file_descriptor_based_iface_init (GFileDescriptorBasedIface *iface)
|
||||
{
|
||||
iface->get_fd = g_local_file_input_stream_get_fd;
|
||||
}
|
||||
|
||||
static void
|
||||
g_local_file_input_stream_init (GLocalFileInputStream *info)
|
||||
{
|
||||
@ -336,3 +348,11 @@ g_local_file_input_stream_query_info (GFileInputStream *stream,
|
||||
attributes,
|
||||
error);
|
||||
}
|
||||
|
||||
static int
|
||||
g_local_file_input_stream_get_fd (GFileDescriptorBased *fd_based)
|
||||
{
|
||||
GLocalFileInputStream *stream = G_LOCAL_FILE_INPUT_STREAM (fd_based);
|
||||
return stream->priv->fd;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user