mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-25 06:50:40 +02:00
GLocalFileInputStream: Implement GFileDescriptorBased
This commit is contained in:
parent
4536a4adbc
commit
670f6210ce
@ -33,6 +33,7 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <glib/gstdio.h>
|
#include <glib/gstdio.h>
|
||||||
#include "gcancellable.h"
|
#include "gcancellable.h"
|
||||||
|
#include "gfiledescriptorbased.h"
|
||||||
#include "gioerror.h"
|
#include "gioerror.h"
|
||||||
#include "glocalfileinputstream.h"
|
#include "glocalfileinputstream.h"
|
||||||
#include "glocalfileinfo.h"
|
#include "glocalfileinfo.h"
|
||||||
@ -44,8 +45,12 @@
|
|||||||
|
|
||||||
#include "gioalias.h"
|
#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
|
#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 {
|
struct _GLocalFileInputStreamPrivate {
|
||||||
int fd;
|
int fd;
|
||||||
@ -75,6 +80,7 @@ static GFileInfo *g_local_file_input_stream_query_info (GFileInputStream *strea
|
|||||||
const char *attributes,
|
const char *attributes,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
static int g_local_file_input_stream_get_fd (GFileDescriptorBased *stream);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
g_local_file_input_stream_finalize (GObject *object)
|
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;
|
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
|
static void
|
||||||
g_local_file_input_stream_init (GLocalFileInputStream *info)
|
g_local_file_input_stream_init (GLocalFileInputStream *info)
|
||||||
{
|
{
|
||||||
@ -336,3 +348,11 @@ g_local_file_input_stream_query_info (GFileInputStream *stream,
|
|||||||
attributes,
|
attributes,
|
||||||
error);
|
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…
x
Reference in New Issue
Block a user