[tracker/direct-access] libtracker-direct: Added initial skeleton here



commit ab40c8d4396b50e5ee1af176a7c7e802283a64ee
Author: Martyn Russell <martyn lanedo com>
Date:   Mon Jul 5 17:03:10 2010 +0100

    libtracker-direct: Added initial skeleton here
    
    Tracker.Direct.Connection uses interface Tracker.Sparql.Cursor and
    will implement it for direct connections using the libtracker-data API

 configure.ac                                  |    1 +
 src/libtracker-direct/Makefile.am             |   46 +++++++++++++++++++++
 src/libtracker-direct/tracker-connection.vala |   54 +++++++++++++++++++++++++
 src/libtracker-sparql/Makefile.am             |    8 ++++
 src/libtracker-sparql/tracker-cursor.vala     |   11 +++--
 src/libtracker-sparql/tracker-sparql.vapi     |   32 +++++++++++++++
 6 files changed, 148 insertions(+), 4 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 8dfc8dc..6f14be1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1888,6 +1888,7 @@ AC_CONFIG_FILES([
 	src/libstemmer/Makefile
 	src/libtracker-common/Makefile
 	src/libtracker-sparql/Makefile
+	src/libtracker-direct/Makefile
 	src/libtracker-data/Makefile
 	src/libtracker-db/Makefile
 	src/libtracker-fts/Makefile
diff --git a/src/libtracker-direct/Makefile.am b/src/libtracker-direct/Makefile.am
new file mode 100644
index 0000000..39f250f
--- /dev/null
+++ b/src/libtracker-direct/Makefile.am
@@ -0,0 +1,46 @@
+include $(top_srcdir)/Makefile.decl
+
+lib_LTLIBRARIES = libtracker-direct- TRACKER_API_VERSION@.la
+
+libtracker_directincludedir = $(includedir)/tracker-$(TRACKER_API_VERSION)/libtracker-direct
+
+libtracker_direct_ TRACKER_API_VERSION@_la_VALASOURCES = \
+	tracker-connection.vala
+
+libtracker_direct_ TRACKER_API_VERSION@_la_SOURCES = 	\
+	libtracker-connection.vala.stamp			\
+	$(libtracker_direct_ TRACKER_API_VERSION@_la_VALASOURCES:.vala=.c)
+
+libtracker_direct_ TRACKER_API_VERSION@_la_LDFLAGS = 	\
+	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) 
+
+#	-export-symbols-regex '^tracker_.*'
+
+libtracker_directinclude_HEADERS = 			\
+	$(top_srcdir)/src/libtracker-sparql/tracker-sparql.vapi	\
+	tracker-connection.h
+
+# Vala sources
+vapi_sources =						\
+	$(top_srcdir)/src/libtracker-sparql/tracker-sparql.vapi	\
+	$(top_srcdir)/src/vapi/posix.vapi		\
+	$(top_srcdir)/src/vapi/glib-2.0-fixes.vapi
+
+libtracker-direct.vala.stamp: $(libtracker_direct_ TRACKER_API_VERSION@_la_VALASOURCES) $(vapi_sources)
+	$(AM_V_GEN)$(VALAC) $(GCOV_VALAFLAGS) -C $(VALAFLAGS) --pkg gio-2.0 -H tracker-connection.h $^
+	$(AM_V_GEN)touch $@
+
+BUILT_SOURCES = 					\
+	libtracker-direct.vala.stamp
+
+CLEANFILES = 						\
+	$(BUILT_SOURCES)
+
+MAINTAINERCLEANFILES =					\
+	$(libtracker_direct_ TRACKER_API_VERSION@_la_VALASOURCES:.vala=.c) \
+	libtracker-direct.vala.stamp			\
+	tracker-connection.h
+
+EXTRA_DIST = 						\
+	$(libtracker_direct_ TRACKER_API_VERSION@_la_VALASOURCES) \
+	libtracker-direct.vala.stamp
diff --git a/src/libtracker-direct/tracker-connection.vala b/src/libtracker-direct/tracker-connection.vala
new file mode 100644
index 0000000..a5a61cb
--- /dev/null
+++ b/src/libtracker-direct/tracker-connection.vala
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2010, Nokia <ivan frade nokia com>
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ */
+
+public class Tracker.Direct.Connection : GLib.Object, Tracker.Sparql.Cursor {
+	private int _n_columns = 0;
+
+	Connection () {
+
+	}
+
+	~Connection () {
+		// Clean up connection
+	}
+
+	public int n_columns { 
+		get { return _n_columns; }
+	}
+
+	public bool get_value (uint column, out GLib.Value value) {
+		return false;
+	}
+
+	public bool get_string (uint column, out string value) {
+		return false;
+	}
+
+	public bool get_double (uint column, out double value) {
+		return false;
+	}
+
+	public bool iter_next () {
+		return false;
+	}
+
+	public bool rewind () {
+		return false;
+	}
+}
\ No newline at end of file
diff --git a/src/libtracker-sparql/Makefile.am b/src/libtracker-sparql/Makefile.am
index 090a353..11a5a87 100644
--- a/src/libtracker-sparql/Makefile.am
+++ b/src/libtracker-sparql/Makefile.am
@@ -19,6 +19,14 @@ libtracker_sparql_ TRACKER_API_VERSION@_la_LDFLAGS = 	\
 libtracker_sparqlinclude_HEADERS = 			\
 	tracker-cursor.h
 
+# Vala bindings
+vapidir = $(datadir)/vala/vapi
+vapi_DATA =                     			\
+	tracker-sparql-$(TRACKER_API_VERSION).vapi
+
+tracker-sparql-$(TRACKER_API_VERSION).vapi: tracker-sparql.vapi
+	cp $< $@
+
 # Vala sources
 vapi_sources =						\
 	$(top_srcdir)/src/vapi/posix.vapi		\
diff --git a/src/libtracker-sparql/tracker-cursor.vala b/src/libtracker-sparql/tracker-cursor.vala
index 204db0b..9f0d1f8 100644
--- a/src/libtracker-sparql/tracker-cursor.vala
+++ b/src/libtracker-sparql/tracker-cursor.vala
@@ -19,11 +19,14 @@
 
 public interface Tracker.Sparql.Cursor {
 	public abstract int n_columns { get; }
-	public abstract bool get_value (uint column, out Value value);
+	public abstract bool get_value (uint column, out GLib.Value value);
 	public abstract bool get_string (uint column, out string value);
 	public abstract bool get_double (uint column, out double value);
-	public abstract bool interrupt () throws GLib.Error;
+	public virtual bool interrupt () throws GLib.Error {
+		warning ("Interrupt interface called when not implemented");
+		return false;
+	}
+
 	public abstract bool iter_next () throws GLib.Error;
 	public abstract bool rewind ();
-}
-
+}
\ No newline at end of file
diff --git a/src/libtracker-sparql/tracker-sparql.vapi b/src/libtracker-sparql/tracker-sparql.vapi
new file mode 100644
index 0000000..1d9525e
--- /dev/null
+++ b/src/libtracker-sparql/tracker-sparql.vapi
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2010, Nokia <ivan frade nokia com>
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ */
+
+[CCode (cprefix = "Tracker", lower_case_cprefix = "tracker_")]
+namespace Tracker {
+	[CCode (cheader_filename = "libtracker-sparql/tracker-cursor.h")]
+    public interface Sparql.Cursor {
+	    public abstract int n_columns { get; }
+	    public abstract bool get_value (uint column, out GLib.Value value);
+	    public abstract bool get_string (uint column, out string value);
+	    public abstract bool get_double (uint column, out double value);
+	    public virtual bool interrupt () throws GLib.Error;
+	    public abstract bool iter_next () throws GLib.Error;
+	    public abstract bool rewind ();
+    }
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]