[gnome-maps/wip/mlundblad/transit-plugin-gtfs-local: 3/3] WIP: Add class for parsing GTFS files



commit 07449dc0e9c20fb6186821a3febbdcd401433328
Author: Marcus Lundblad <ml update uu se>
Date:   Sat Feb 15 09:29:35 2020 +0100

    WIP: Add class for parsing GTFS files

 lib/maps-gtfs.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/maps-gtfs.h | 46 ++++++++++++++++++++++++++++++++++++++++++++
 lib/meson.build |  2 ++
 3 files changed, 107 insertions(+)
---
diff --git a/lib/maps-gtfs.c b/lib/maps-gtfs.c
new file mode 100644
index 00000000..451f52f8
--- /dev/null
+++ b/lib/maps-gtfs.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2020 Marcus Lundblad
+ *
+ * GNOME Maps is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * GNOME Maps 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 General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with GNOME Maps; if not, see <http://www.gnu.org/licenses/>
+ *
+ * Author: Marcus Lundblad <ml update uu se>
+ */
+
+#include "maps-gtfs.h"
+
+struct _MapsGTFSPrivate
+{
+  char *file;
+};
+
+enum {
+  PROP_0,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (MapsGTFS, maps_gtfs, G_TYPE_OBJECT)
+
+static void
+maps_gtfs_class_init (MapsGTFSClass *klass)
+{
+}
+
+static void
+maps_gtfs_init (MapsGTFS *gtfs)
+{
+  gtfs->priv = maps_gtfs_get_instance_private (gtfs);
+  gtfs->priv->file = NULL;
+}
+
+MapsGTFS *
+maps_gtfs_new (char *file)
+{
+  MapsGTFS *gtfs = g_object_new (MAPS_TYPE_GTFS, NULL);
+  MapsGTFSPrivate *priv = maps_gtfs_get_instance_private (gtfs);
+
+  priv->file = g_strdup (file);
+  return gtfs;
+}
+
+void
+maps_gtfs_parse (GError **error)
+{
+
+}
diff --git a/lib/maps-gtfs.h b/lib/maps-gtfs.h
new file mode 100644
index 00000000..a3f7eb0c
--- /dev/null
+++ b/lib/maps-gtfs.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2020 Marcus Lundblad
+ *
+ * GNOME Maps is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * GNOME Maps 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 General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with GNOME Maps; if not, see <http://www.gnu.org/licenses/>
+ *
+ * Author: Marcus Lundblad <ml update uu se>
+ */
+
+#ifndef __MAPS_GTFS__
+#define __MAPS_GTFS__
+
+#include <glib-object.h>
+
+#define MAPS_TYPE_GTFS maps_gtfs_get_type ()
+G_DECLARE_FINAL_TYPE(MapsGTFS, maps_gtfs, MAPS, GTFS, GObject)
+
+typedef struct _MapsGTFSPrivate MapsGTFSPrivate;
+
+struct _MapsGTFS
+{
+  GObject parent_instance;
+  MapsGTFSPrivate *priv;
+};
+
+
+struct _MapsGTFSClass
+{
+  GObjectClass parent_class;
+};
+
+MapsGTFS *maps_gtfs_new (char *file);
+
+void maps_gtfs_parse (GError **error);
+
+#endif //__MAPS_GTFS__
diff --git a/lib/meson.build b/lib/meson.build
index 60543648..c2f72ac3 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -4,6 +4,7 @@ headers_private = files(
        'maps-contact.h',
        'maps-contact-store.h',
        'maps-file-tile-source.h',
+       'maps-gtfs.h',
        'maps-osm.h',
        'maps-osm-changeset.h',
        'maps-osm-node.h',
@@ -17,6 +18,7 @@ sources = files(
        'maps-contact.c',
        'maps-contact-store.c',
        'maps-file-tile-source.c',
+       'maps-gtfs.c',
        'maps-osm.c',
        'maps-osm-changeset.c',
        'maps-osm-node.c',


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