[tracker/wip/sam/resource: 19/22] libtracker-sparql: Initial work on TrackerNamespaceManager



commit c13ecc5f7d8eb2f839a6534a87b1db5bb47b37df
Author: Sam Thursfield <sam afuera me uk>
Date:   Fri Apr 8 17:57:46 2016 +0100

    libtracker-sparql: Initial work on TrackerNamespaceManager
    
    This will keep track of a set of namespaces and their prefixes. Then,
    when we are serializing a resource, we can use it.

 src/libtracker-sparql/Makefile.am                 |    3 +
 src/libtracker-sparql/tracker-namespace-manager.c |   68 +++++++++++++++++++++
 src/libtracker-sparql/tracker-namespace-manager.h |   44 +++++++++++++
 3 files changed, 115 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-sparql/Makefile.am b/src/libtracker-sparql/Makefile.am
index 593cd63..1f76696 100644
--- a/src/libtracker-sparql/Makefile.am
+++ b/src/libtracker-sparql/Makefile.am
@@ -24,6 +24,8 @@ libtracker_sparql_la_SOURCES =   \
        tracker-cursor.vala                            \
        tracker-namespace.c                            \
        tracker-namespace.h                            \
+       tracker-namespace-manager.c                    \
+       tracker-namespace-manager.h                    \
        tracker-resource.c                             \
        tracker-resource.h                             \
        tracker-utils.vala                             \
@@ -53,6 +55,7 @@ tracker-sparql-$(TRACKER_API_VERSION).vapi: tracker-sparql.vapi
 libtracker_sparqlinclude_HEADERS =                     \
        $(vala_header)                                 \
        tracker-namespace.h                            \
+       tracker-namespace-manager.h                    \
        tracker-ontologies.h \
        tracker-resource.h                             \
        tracker-sparql.h                               \
diff --git a/src/libtracker-sparql/tracker-namespace-manager.c 
b/src/libtracker-sparql/tracker-namespace-manager.c
new file mode 100644
index 0000000..dde9d8b
--- /dev/null
+++ b/src/libtracker-sparql/tracker-namespace-manager.c
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2016, Sam Thursfield <sam afuera me uk>
+ *
+ * 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.
+ */
+
+#include "config.h"
+
+#include <string.h>
+#include <stdlib.h>
+
+#include <glib.h>
+
+#include "tracker-namespace-manager.h"
+
+typedef struct {
+} TrackerNamespaceManagerPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (TrackerNamespaceManager, tracker_namespace_manager, G_TYPE_OBJECT);
+#define GET_PRIVATE(object)  (tracker_namespace_manager_get_instance_private (object))
+
+
+static void finalize     (GObject      *object);
+
+static void
+tracker_namespace_manager_class_init (TrackerNamespaceManagerClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+       object_class->finalize     = finalize;
+}
+
+static void
+tracker_namespace_manager_init (TrackerNamespaceManager *self)
+{
+       TrackerNamespaceManagerPrivate *priv = GET_PRIVATE (self);
+}
+
+static void
+finalize (GObject *object)
+{
+       TrackerNamespaceManagerPrivate *priv = GET_PRIVATE (self);
+
+       priv = GET_PRIV (object);
+
+       (G_OBJECT_CLASS (tracker_namespace_manager_parent_class)->finalize) (object);
+}
+
+TrackerNamespaceManager *
+tracker_namespace_manager_new ()
+{
+       TrackerNamespaceManager *namespace;
+
+       namespace_manager = g_object_new (TRACKER_TYPE_NAMESPACE_MANAGER, NULL);
+}
diff --git a/src/libtracker-sparql/tracker-namespace-manager.h 
b/src/libtracker-sparql/tracker-namespace-manager.h
new file mode 100644
index 0000000..8d52891
--- /dev/null
+++ b/src/libtracker-sparql/tracker-namespace-manager.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2016, Sam Thursfield <sam afuera me uk>
+ *
+ * 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.
+ */
+
+#ifndef __LIBTRACKER_SPARQL_NAMESPACE_MANAGER_H__
+#define __LIBTRACKER_SPARQL_NAMESPACE_MANAGER_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#if !defined (__LIBTRACKER_SPARQL_INSIDE__) && !defined (TRACKER_COMPILATION)
+#error "only <libtracker-sparql/tracker-sparql.h> must be included directly."
+#endif
+
+#define TRACKER_TYPE_NAMESPACE_MANAGER (tracker_namespace_manager_get_type())
+G_DECLARE_FINAL_TYPE (TrackerNamespaceManager, tracker_namespace_manager, TRACKER, NAMESPACE_MANAGER, 
GObject);
+
+struct _TrackerNamespaceManagerClass
+{
+       GObjectClass parent_class;
+};
+
+GType             tracker_namespace_manager_get_type      (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __LIBTRACKER_SPARQL_NAMESPACE_MANAGER_H__ */
+


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