[tracker] libtracker-sparql: Add vapi file for the C portions



commit 1b312602920959649befce085fe5365b38370196
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Jul 10 23:58:21 2017 +0200

    libtracker-sparql: Add vapi file for the C portions
    
    Just like we do with girs, merge together the vapi for the C portions and
    the generated vapi for the vala bits. This allows using
    TrackerNamespaceManager and TrackerResource from vala code.

 src/libtracker-sparql/Makefile.am                  |   12 ++-
 .../libtracker-sparql-intermediate-c.vapi          |  103 ++++++++++++++++++++
 src/libtracker-sparql/meson.build                  |    2 +-
 3 files changed, 113 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-sparql/Makefile.am b/src/libtracker-sparql/Makefile.am
index 192d98e..5a96f81 100644
--- a/src/libtracker-sparql/Makefile.am
+++ b/src/libtracker-sparql/Makefile.am
@@ -7,7 +7,8 @@ libtracker_sparql_intermediate_vala_la_VALAFLAGS =     \
        --header $(vala_header:.h=-no-checks.h)        \
        --vapi tracker-sparql.vapi                     \
        --pkg gio-2.0 --pkg posix                      \
-       $(BUILD_VALAFLAGS)
+       $(BUILD_VALAFLAGS)                             \
+       libtracker-sparql-intermediate-c.vapi
 
 AM_CPPFLAGS =                                          \
        $(BUILD_VALACFLAGS)                            \
@@ -64,8 +65,12 @@ vala_header = tracker-generated.h
                    echo "#endif") > $@
        $(AM_V_GEN)(cat $< >> $@)
 
-tracker-sparql-$(TRACKER_API_VERSION).vapi: tracker-sparql.vapi
-       $(AM_V_GEN)(sed -e 's/tracker-generated-no-checks.h/tracker-sparql.h/' $< > $@)
+VAPIFILES = \
+       libtracker-sparql-intermediate-c.vapi \
+       tracker-sparql.vapi
+
+tracker-sparql-$(TRACKER_API_VERSION).vapi: $(VAPIFILES)
+       $(AM_V_GEN)(sed -e 's/tracker-generated-no-checks.h/tracker-sparql.h/' $(VAPIFILES) > $@)
 
 libtracker_sparqlinclude_HEADERS =                     \
        $(vala_header)                                 \
@@ -113,4 +118,5 @@ EXTRA_DIST =                                           \
        tracker-sparql.deps                            \
        $(vala_header:.h=-no-checks.h)                 \
        tracker-sparql-add-include-guards.sh           \
+       libtracker-sparql-intermediate-c.vapi          \
        meson.build
diff --git a/src/libtracker-sparql/libtracker-sparql-intermediate-c.vapi 
b/src/libtracker-sparql/libtracker-sparql-intermediate-c.vapi
new file mode 100644
index 0000000..4dc894a
--- /dev/null
+++ b/src/libtracker-sparql/libtracker-sparql-intermediate-c.vapi
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2017 - Red Hat Inc
+ *
+ * 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.
+ */
+
+namespace Tracker {
+       [CCode (cheader_filename = "libtracker-sparql/tracker-namespace-manager.h")]
+       public class NamespaceManager : GLib.Object {
+               public NamespaceManager ();
+               public void add_prefix (string prefix, string namespace);
+               public bool has_prefix (string prefix);
+               public string lookup_prefix (string prefix);
+               public string expand_uri (string compact_uri);
+
+               public static NamespaceManager get_default ();
+       }
+
+       [CCode (cheader_filename = "libtracker-sparql/tracker-resource.h")]
+       public class Resource : GLib.Object {
+               public Resource (string identifier);
+
+               public void set_value (string predicate, GLib.Value value);
+               public void set_boolean (string predicate, bool object);
+               public void set_double (string predicate, double object);
+               public void set_int (string predicate, int object);
+               public void set_int64 (string predicate, int64 object);
+               public void set_relation (string predicate, Resource object);
+               public void set_string (string predicate, string object);
+               public void set_uri (string predicate, string object);
+
+               public void add_value (string predicate, GLib.Value value);
+               public void add_boolean (string predicate, bool object);
+               public void add_double (string predicate, double object);
+               public void add_int (string predicate, int object);
+               public void add_int64 (string predicate, int64 object);
+               public void add_relation (string predicate, Resource object);
+               public void add_string (string predicate, string object);
+               public void add_uri (string predicate, string object);
+
+               public GLib.List<GLib.Value> get_values (string predicate);
+
+               public bool get_first_boolean (string predicate);
+               public double get_first_double (string predicate);
+               public int get_first_int (string predicate);
+               public int64 get_first_int64 (string predicate);
+               public unowned Resource get_first_relation (string predicate);
+               public string get_first_string (string predicate);
+               public string get_first_uri (string predicate);
+
+               public string get_identifier ();
+               public void set_identifier (string identifier);
+
+               public int identifier_compare_func (string identifier);
+
+               public string print_turtle (NamespaceManager? namespace_manager);
+               public string print_sparql_update (NamespaceManager? namespace_manager, string graph);
+       }
+
+       [CCode (cprefix = "TRACKER_NOTIFIER_FLAG_", cheader_filename = 
"libtracker-sparql/tracker-notifier.h")]
+       public enum NotifierFlags {
+               QUERY_URN,
+               QUERY_LOCATION,
+               NOTIFY_UNEXTRACTED
+       }
+
+       public enum NotifierEventType {
+               QUERY_URN,
+               QUERY_LOCATION,
+               NOTIFY_UNEXTRACTED
+       }
+
+       [CCode (cheader_filename = "libtracker-sparql/tracker-notifier.h")]
+       public class Notifier : GLib.Object, GLib.Initable {
+               public Notifier (string[] classes, NotifierFlags flags, GLib.Cancellable? cancellable) throws 
GLib.Error;
+
+               public class NotifierEvent {
+                       public enum Type {
+                               CREATE,
+                               DELETE,
+                               UPDATE
+                       }
+
+                       public int64 get_id ();
+                       public string get_type ();
+                       public string get_urn ();
+                       public string get_location ();
+               }
+       }
+}
diff --git a/src/libtracker-sparql/meson.build b/src/libtracker-sparql/meson.build
index 2fe824c..e41625d 100644
--- a/src/libtracker-sparql/meson.build
+++ b/src/libtracker-sparql/meson.build
@@ -105,7 +105,7 @@ meson.add_install_script('../install-generated-header.sh',
 custom_target('tracker-sparql-' + tracker_api_version + '.vapi',
     #input: 'tracker-sparql-intermediate-vala.vapi',
     output: 'tracker-sparql-' + tracker_api_version + '.vapi',
-    command: ['sed', '-e', 's/tracker-generated-no-checks.h/tracker-sparql.h/', 
join_paths(meson.current_build_dir(), 'tracker-sparql-intermediate-vala.vapi')],
+    command: ['sed', '-e', 's/tracker-generated-no-checks.h/tracker-sparql.h/', 
join_paths(meson.current_build_dir(), 'tracker-sparql-intermediate-c.vapi', 
'tracker-sparql-intermediate-vala.vapi')],
     depends: libtracker_sparql_intermediate_vala,
     capture: true,
     install: true,


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