[tracker/libtracker-sparql: 3/41] libtracker-sparql: Add Sparql.Connection, use abstract classes



commit 848d402aa1ce5f375d921851b01bd372ce82e19a
Author: Jürg Billeter <j bitron ch>
Date:   Mon Jul 5 18:29:07 2010 +0200

    libtracker-sparql: Add Sparql.Connection, use abstract classes

 src/libtracker-sparql/.gitignore              |    8 ++++++++
 src/libtracker-sparql/Makefile.am             |   20 +++++++++++++++-----
 src/libtracker-sparql/tracker-connection.vala |   22 ++++++++++++++++++++++
 src/libtracker-sparql/tracker-cursor.vala     |   10 ++++------
 4 files changed, 49 insertions(+), 11 deletions(-)
---
diff --git a/src/libtracker-sparql/.gitignore b/src/libtracker-sparql/.gitignore
new file mode 100644
index 0000000..7457f22
--- /dev/null
+++ b/src/libtracker-sparql/.gitignore
@@ -0,0 +1,8 @@
+tracker-builder.c
+tracker-connection.c
+tracker-cursor.c
+tracker-plugin-loader.c
+tracker-query.c
+tracker-sparql-*.vapi
+tracker-sparql.h
+tracker-utils.c
diff --git a/src/libtracker-sparql/Makefile.am b/src/libtracker-sparql/Makefile.am
index 409c90d..2800951 100644
--- a/src/libtracker-sparql/Makefile.am
+++ b/src/libtracker-sparql/Makefile.am
@@ -1,15 +1,25 @@
 include $(top_srcdir)/Makefile.decl
 
+INCLUDES =								\
+	-DG_LOG_DOMAIN=\"Tracker\"					\
+	-DTRACKER_COMPILATION						\
+	-I$(top_srcdir)/src						\
+	-I$(top_builddir)/src						\
+	$(WARN_CFLAGS)							\
+	$(GLIB2_CFLAGS)							\
+	$(GCOV_CFLAGS)
+
 lib_LTLIBRARIES = libtracker-sparql- TRACKER_API_VERSION@.la
 
 libtracker_sparqlincludedir = $(includedir)/tracker-$(TRACKER_API_VERSION)/libtracker-sparql
 
-libtracker_sparql_ TRACKER_API_VERSION@_la_VALASOURCES = \
+libtracker_sparql_la_VALASOURCES = \
+	tracker-connection.vala				\
 	tracker-cursor.vala
 
 libtracker_sparql_ TRACKER_API_VERSION@_la_SOURCES = 	\
 	libtracker-sparql.vala.stamp			\
-	$(libtracker_sparql_ TRACKER_API_VERSION@_la_VALASOURCES:.vala=.c)
+	$(libtracker_sparql_la_VALASOURCES:.vala=.c)
 
 libtracker_sparql_ TRACKER_API_VERSION@_la_LDFLAGS = 	\
 	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
@@ -25,7 +35,7 @@ vapi_DATA =                     			\
 	tracker-sparql-$(TRACKER_API_VERSION).vapi
 
 # Vala sources
-libtracker-sparql.vala.stamp: $(libtracker_sparql_ TRACKER_API_VERSION@_la_VALASOURCES)
+libtracker-sparql.vala.stamp: $(libtracker_sparql_la_VALASOURCES)
 	$(AM_V_GEN)$(VALAC) $(GCOV_VALAFLAGS) -C $(VALAFLAGS) --pkg gio-2.0 -H tracker-sparql.h --vapi tracker-sparql-$(TRACKER_API_VERSION).vapi $^
 	$(AM_V_GEN)touch $@
 
@@ -36,10 +46,10 @@ CLEANFILES = 						\
 	$(BUILT_SOURCES)
 
 MAINTAINERCLEANFILES =					\
-	$(libtracker_sparql_ TRACKER_API_VERSION@_la_VALASOURCES:.vala=.c) \
+	$(libtracker_sparql_la_VALASOURCES:.vala=.c) \
 	libtracker-sparql.vala.stamp			\
 	tracker-sparql.h
 
 EXTRA_DIST = 						\
-	$(libtracker_sparql_ TRACKER_API_VERSION@_la_VALASOURCES) \
+	$(libtracker_sparql_la_VALASOURCES) \
 	libtracker-sparql.vala.stamp
diff --git a/src/libtracker-sparql/tracker-connection.vala b/src/libtracker-sparql/tracker-connection.vala
new file mode 100644
index 0000000..f576d5c
--- /dev/null
+++ b/src/libtracker-sparql/tracker-connection.vala
@@ -0,0 +1,22 @@
+/*
+ * 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 abstract class Tracker.Sparql.Connection : Object {
+	public abstract Cursor query (string sparql) throws GLib.Error;
+}
diff --git a/src/libtracker-sparql/tracker-cursor.vala b/src/libtracker-sparql/tracker-cursor.vala
index 9f0d1f8..c30861a 100644
--- a/src/libtracker-sparql/tracker-cursor.vala
+++ b/src/libtracker-sparql/tracker-cursor.vala
@@ -17,16 +17,14 @@
  * Boston, MA  02110-1301, USA.
  */
 
-public interface Tracker.Sparql.Cursor {
+public abstract class Tracker.Sparql.Cursor : Object {
 	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 abstract unowned string get_string (int column, out int length = null);
 	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
+	public abstract void rewind ();
+}



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