[PATCH 3/9] core: Add place to store related keys and values.



Special GrlData to store all related keys and its values.

Suited to be used by GrlMultiData.

Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>
---
 src/Makefile.am         |    2 +
 src/data/grl-property.c |   61 +++++++++++++++++++++++++++++
 src/data/grl-property.h |   99 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 162 insertions(+), 0 deletions(-)
 create mode 100644 src/data/grl-property.c
 create mode 100644 src/data/grl-property.h

diff --git a/src/Makefile.am b/src/Makefile.am
index 91dac9e..0b37616 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -52,6 +52,7 @@ lib@GRL_NAME@_la_SOURCES =					\
 data_c_sources =		\
 	data/grl-data.c		\
 	data/grl-data-multi.c	\
+	data/grl-property.c	\
 	data/grl-media.c	\
 	data/grl-media-audio.c	\
 	data/grl-media-video.c	\
@@ -80,6 +81,7 @@ lib@GRL_NAME@inc_HEADERS =	\
 data_h_headers =		\
 	data/grl-data.h		\
 	data/grl-data-multi.h	\
+	data/grl-property.h	\
 	data/grl-media.h	\
 	data/grl-media-box.h	\
 	data/grl-media-audio.h	\
diff --git a/src/data/grl-property.c b/src/data/grl-property.c
new file mode 100644
index 0000000..f3d21bd
--- /dev/null
+++ b/src/data/grl-property.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2011 Igalia S.L.
+ *
+ * Contact: Iago Toral Quiroga <itoral igalia com>
+ *
+ * Authors: Juan A. Suarez Romero <jasuarez igalia 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; 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 St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+/**
+ * SECTION:grl-property
+ * @short_description: A class where to store related metadata keys.
+ *
+ */
+
+#include "grl-property.h"
+#include "grl-log.h"
+
+G_DEFINE_TYPE (GrlProperty, grl_property, GRL_TYPE_DATA);
+
+static void
+grl_property_class_init (GrlPropertyClass *klass)
+{
+}
+
+static void
+grl_property_init (GrlProperty *self)
+{
+}
+
+/**
+ * grl_property_new:
+ *
+ * Creates a new place to store related keys and values.
+ *
+ * Returns: a new object.
+ **/
+GrlProperty *
+grl_property_new (void)
+{
+  GrlProperty *grlprop = g_object_new (GRL_TYPE_PROPERTY, NULL);
+
+  g_object_set (grlprop, "overwrite", TRUE, NULL);
+
+  return grlprop;
+}
diff --git a/src/data/grl-property.h b/src/data/grl-property.h
new file mode 100644
index 0000000..4628043
--- /dev/null
+++ b/src/data/grl-property.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2011 Igalia S.L.
+ *
+ * Contact: Iago Toral Quiroga <itoral igalia com>
+ *
+ * Authors: Juan A. Suarez Romero <jasuarez igalia 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; 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 St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#if !defined (_GRILO_H_INSIDE_) && !defined (GRILO_COMPILATION)
+#error "Only <grilo.h> can be included directly."
+#endif
+
+#ifndef _GRL_PROPERTY_H_
+#define _GRL_PROPERTY_H_
+
+#include <grl-data.h>
+#include <glib-object.h>
+/* #include <grl-metadata-key.h> */
+/* #include <grl-definitions.h> */
+
+G_BEGIN_DECLS
+
+#define GRL_TYPE_PROPERTY                       \
+  (grl_property_get_type())
+
+#define GRL_PROPERTY(obj)                               \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj),                   \
+                               GRL_TYPE_PROPERTY,       \
+                               GrlProperty))
+
+#define GRL_PROPERTY_CLASS(klass)               \
+  (G_TYPE_CHECK_CLASS_CAST ((klass),            \
+                            GRL_TYPE_PROPERTY,  \
+                            GrlPropertyClass))
+
+#define GRL_IS_PROPERTY(obj)                            \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj),                   \
+                               GRL_TYPE_PROPERTY))
+
+#define GRL_IS_PROPERTY_CLASS(klass)            \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass),            \
+                            GRL_TYPE_PROPERTY))
+
+#define GRL_PROPERTY_GET_CLASS(obj)                     \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj),                    \
+                              GRL_TYPE_PROPERTY,        \
+                              GrlPropertyClass))
+
+typedef struct _GrlProperty        GrlProperty;
+typedef struct _GrlPropertyPrivate GrlPropertyPrivate;
+typedef struct _GrlPropertyClass   GrlPropertyClass;
+
+/**
+ * GrlPropertyClass:
+ * @parent_class: the parent class structure
+ *
+ * Grilo Data Multivalued class
+ */
+struct _GrlPropertyClass
+{
+  GrlDataClass parent_class;
+
+  /*< private >*/
+  gpointer _grl_reserved[GRL_PADDING];
+};
+
+struct _GrlProperty
+{
+  GrlData parent;
+
+  /*< private >*/
+  GrlPropertyPrivate *priv;
+
+  gpointer _grl_reserved[GRL_PADDING_SMALL];
+};
+
+GType grl_property_get_type (void) G_GNUC_CONST;
+
+GrlProperty *grl_property_new (void);
+
+G_END_DECLS
+
+#endif /* _GRL_PROPERTY_H_ */
-- 
1.7.1



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