summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-06-16 16:40:48 -0700
committerCedric BAIL <cedric@osg.samsung.com>2016-06-22 14:39:33 -0700
commitfc1271d17837297d0a53ac1265fc639f2b3ccfc6 (patch)
tree97002b1f0ccc48243e50258c94f5f0a94cd5790b
parent3981d996692d50bb811d637b1e823df821e4c0c1 (diff)
downloadefl-fc1271d17837297d0a53ac1265fc639f2b3ccfc6.tar.gz
eio: add an Efl.Uri.Mapper for file.
We will need a way to initialize Eio on a specific main loop. Maybe by manually creating an Efl.Io.Manager and registering it on one. Don't know. This is for later.
-rw-r--r--src/Makefile_Eio.am9
-rw-r--r--src/lib/eio/efl_uri_mapper_file.c43
-rw-r--r--src/lib/eio/efl_uri_mapper_file.eo6
-rw-r--r--src/lib/eio/eio_private.h2
4 files changed, 58 insertions, 2 deletions
diff --git a/src/Makefile_Eio.am b/src/Makefile_Eio.am
index 4c28c8a69d..3659070414 100644
--- a/src/Makefile_Eio.am
+++ b/src/Makefile_Eio.am
@@ -6,8 +6,12 @@ eio_eolian_files = \
lib/eio/efl_io_manager.eo \
lib/eio/eio_sentry.eo
-eio_eolian_h = $(eio_eolian_files:%.eo=%.eo.h)
-eio_eolian_c = $(eio_eolian_files:%.eo=%.eo.c)
+eio_eolian_files_private = \
+ lib/eio/efl_uri_mapper_file.eo \
+ $(eio_eolian_files)
+
+eio_eolian_h = $(eio_eolian_files_private:%.eo=%.eo.h)
+eio_eolian_c = $(eio_eolian_files_private:%.eo=%.eo.c)
BUILT_SOURCES += $(eio_eolian_c) $(eio_eolian_h)
@@ -42,6 +46,7 @@ lib/eio/eio_monitor_poll.c \
lib/eio/eio_single.c \
lib/eio/eio_xattr.c \
lib/eio/eio_model.c \
+lib/eio/efl_uri_mapper_file.c \
lib/eio/eio_model_private.h \
lib/eio/eio_private.h \
lib/eio/eio_sentry_private.h
diff --git a/src/lib/eio/efl_uri_mapper_file.c b/src/lib/eio/efl_uri_mapper_file.c
new file mode 100644
index 0000000000..f5f13fc75c
--- /dev/null
+++ b/src/lib/eio/efl_uri_mapper_file.c
@@ -0,0 +1,43 @@
+/* EIO - EFL data type library
+ * Copyright (C) 2010 Enlightenment Developers:
+ * Cedric Bail <cedric.bail@free.fr>
+ *
+ * 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 "eio_private.h"
+
+#include "efl_uri_mapper_file.eo.h"
+
+typedef struct _Efl_Uri_Mapper_File_Data Efl_Uri_Mapper_File_Data;
+struct _Efl_Uri_Mapper_File_Data
+{
+};
+
+static Eina_Promise *
+_efl_uri_mapper_file_efl_uri_mapper_fetch(Eo *obj, Efl_Uri_Mapper_File_Data *pd EINA_UNUSED, const Eina_Stringshare *file)
+{
+ Efl_Io_Manager *iom;
+ unsigned int offset = 0;
+
+ iom = eo_provider_find(obj, EFL_IO_MANAGER_CLASS);
+ if (!iom) return NULL;
+
+ if (!strncmp("file://", file, 7))
+ offset += 7;
+
+ return efl_io_manager_file_open(iom, file + offset, EINA_FALSE);
+}
+
+#include "efl_uri_mapper_file.eo.c"
diff --git a/src/lib/eio/efl_uri_mapper_file.eo b/src/lib/eio/efl_uri_mapper_file.eo
new file mode 100644
index 0000000000..4b0f24d8e0
--- /dev/null
+++ b/src/lib/eio/efl_uri_mapper_file.eo
@@ -0,0 +1,6 @@
+class Efl.Uri.Mapper.File (Eo.Base, Efl.Uri.Mapper)
+{
+ implements {
+ Efl.Uri.Mapper.fetch;
+ }
+}
diff --git a/src/lib/eio/eio_private.h b/src/lib/eio/eio_private.h
index 6d58f9f6f5..815ed9a9dc 100644
--- a/src/lib/eio/eio_private.h
+++ b/src/lib/eio/eio_private.h
@@ -55,6 +55,8 @@
#include "Eio.h"
+#include "efl_uri_mapper_file.eo.h"
+
#ifdef _WIN32
typedef struct __stat64 _eio_stat_t;
#define _eio_stat(p, b) _stat64(p, b)