[glibmm] Add the Gio::FileDescriptorBased interface
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Add the Gio::FileDescriptorBased interface
- Date: Fri, 23 Jun 2017 07:29:38 +0000 (UTC)
commit 4c3f450bb5fd7579a9909bf3be3c1b362850f555
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Fri Jun 23 09:25:02 2017 +0200
Add the Gio::FileDescriptorBased interface
GUnixInputStream and GUnixOutputStream implement GFileDescriptorBased.
gio/giomm.h | 3 ++
gio/src/filedescriptorbased.ccg | 18 ++++++++++++++
gio/src/filedescriptorbased.hg | 50 +++++++++++++++++++++++++++++++++++++++
gio/src/filelist.am | 1 +
gio/src/gio_vfuncs.defs | 7 +++++
5 files changed, 79 insertions(+), 0 deletions(-)
---
diff --git a/gio/giomm.h b/gio/giomm.h
index 8d5376b..3b79ed1 100644
--- a/gio/giomm.h
+++ b/gio/giomm.h
@@ -72,6 +72,9 @@
#include <giomm/file.h>
#include <giomm/fileattributeinfo.h>
#include <giomm/fileattributeinfolist.h>
+#ifndef G_OS_WIN32
+#include <giomm/filedescriptorbased.h>
+#endif
#include <giomm/fileenumerator.h>
#include <giomm/fileicon.h>
#include <giomm/fileinfo.h>
diff --git a/gio/src/filedescriptorbased.ccg b/gio/src/filedescriptorbased.ccg
new file mode 100644
index 0000000..84882c1
--- /dev/null
+++ b/gio/src/filedescriptorbased.ccg
@@ -0,0 +1,18 @@
+/* Copyright (C) 2017 The giomm Development Team
+ *
+ * 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 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include <gio/gio.h>
+#include <gio/gfiledescriptorbased.h>
diff --git a/gio/src/filedescriptorbased.hg b/gio/src/filedescriptorbased.hg
new file mode 100644
index 0000000..9d8308e
--- /dev/null
+++ b/gio/src/filedescriptorbased.hg
@@ -0,0 +1,50 @@
+/* Copyright (C) 2017 The giomm Development Team
+ *
+ * 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 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include <glibmm/interface.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(glibmm/private/interface_p.h)
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+typedef struct _GFileDescriptorBasedIface GFileDescriptorBasedIface;
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+namespace Gio
+{
+
+/** Interface for file descriptor based IO.
+ *
+ * %FileDescriptorBased is implemented by streams (implementations of
+ * Gio::InputStream or Gio::OutputStream) that are based on file descriptors.
+ *
+ * @ingroup Streams
+ *
+ * @newin{2,54}
+ */
+class FileDescriptorBased : public Glib::Interface
+{
+ _CLASS_INTERFACE(FileDescriptorBased, GFileDescriptorBased, G_FILE_DESCRIPTOR_BASED,
GFileDescriptorBasedIface)
+ _GTKMMPROC_WIN32_NO_WRAP
+
+public:
+ _WRAP_METHOD(int get_fd() const, g_file_descriptor_based_get_fd, newin "2,54")
+
+protected:
+ _WRAP_VFUNC(int get_fd() const, "get_fd")
+};
+
+} // namespace Gio
diff --git a/gio/src/filelist.am b/gio/src/filelist.am
index 7342df8..11515fa 100644
--- a/gio/src/filelist.am
+++ b/gio/src/filelist.am
@@ -137,6 +137,7 @@ giomm_files_any_hg = \
zlibcompressor.hg
giomm_files_posix_hg = \
+ filedescriptorbased.hg \
unixconnection.hg \
unixcredentialsmessage.hg \
unixfdlist.hg \
diff --git a/gio/src/gio_vfuncs.defs b/gio/src/gio_vfuncs.defs
index f8c94da..8dfac73 100644
--- a/gio/src/gio_vfuncs.defs
+++ b/gio/src/gio_vfuncs.defs
@@ -577,6 +577,13 @@
)
)
+; GFileDescriptorBased
+
+(define-vfunc get_fd
+ (of-object "GFileDescriptorBased")
+ (return-type "int")
+)
+
; GFileInputStream
(define-vfunc tell
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]