soylent r195 - trunk/libsoylent



Author: svenp
Date: Wed Jul  9 14:05:38 2008
New Revision: 195
URL: http://svn.gnome.org/viewvc/soylent?rev=195&view=rev

Log:
added stubs for most SlEntity methods
added attributes and attribute-handlers (stubs)

Added:
   trunk/libsoylent/sl-entity-handler.c
   trunk/libsoylent/sl-entity-handler.h

Added: trunk/libsoylent/sl-entity-handler.c
==============================================================================
--- (empty file)
+++ trunk/libsoylent/sl-entity-handler.c	Wed Jul  9 14:05:38 2008
@@ -0,0 +1,40 @@
+/**/
+
+#include "sl-entity-handler.h"
+
+GType
+sl_entity_handler_get_type (void)
+{
+  static GType type = 0;
+  static const GTypeInfo info =
+    {
+      sizeof (SlEntityHandlerClass),
+      NULL,
+      NULL,
+      NULL,
+      NULL,
+      NULL,
+      sizeof (SlEntityHandler),
+      0,
+      NULL,
+      NULL
+    };
+  
+  if (type == 0)
+    {
+      type = g_type_register_static (G_TYPE_INTERFACE, "SlEntityHandler", &info,
+        0);
+    }
+  return type;
+}
+
+gchar *sl_entity_handler_get (SlEntityHandler *self, gchar *attrname)
+{
+  return SL_ENTITY_HANDLER_GET_CLASS (self)->get(self, attrname);
+}
+
+void sl_entity_handler_set (SlEntityHandler *self, gchar *attrname,
+  gchar *value)
+{
+  SL_ENTITY_HANDLER_GET_CLASS (self)->set(self, attrname, value);
+}

Added: trunk/libsoylent/sl-entity-handler.h
==============================================================================
--- (empty file)
+++ trunk/libsoylent/sl-entity-handler.h	Wed Jul  9 14:05:38 2008
@@ -0,0 +1,41 @@
+/**/
+
+#ifndef SL_ENTITY_HANDLER_H
+#define SL_ENTITY_HANDLER_H
+
+#include <glib.h>
+#include <glib-object.h>
+
+#define SL_ENTITY_HANDLER_TYPE            (sl_entity_handler_get_type ())
+#define SL_ENTITY_HANDLER(obj)            (G_TYPE_CHECK_INSTANCE_CAST (obj, \
+  SL_ENTITY_HANDLER_TYPE, SlEntityHandler))
+#define SL_ENTITY_HANDLER_CLASS(cls)      (G_TYPE_CHECK_CLASS_CAST (cls, \
+  SL_ENTITY_HANDLER_TYPE, SlEntityHandlerClass))
+#define SL_IS_ENTITY_HANDLER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE (obj, \
+  SL_ENTITY_HANDLER_TYPE))
+#define SL_IS_ENTITY_HANDLER_CLASS(cls)   (G_TYPE_CHECK_CLASS_TYPE (cls, \
+  SL_ENTITY_HANDLER_TYPE))
+#define SL_ENTITY_HANDLER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_INTERFACE (obj, \
+  SL_ENTITY_HANDLER_TYPE, SlEntityHandlerClass))
+
+typedef struct _SlEntityHandler       SlEntityHandler;
+typedef struct _SlEntityHandlerClass  SlEntityHandlerClass;
+
+struct _SlEntityHandler {};
+
+struct _SlEntityHandlerClass
+{
+  GTypeInterface parent;
+  gchar *(*get) (SlEntityHandler *self, gchar *attrname);
+  void (*set) (SlEntityHandler *self, gchar *attrname, gchar *value);
+};
+
+GType sl_entity_handler_get_type (void);
+
+/* TODO: add other methods (set_at, set_values etc.) */
+
+gchar *sl_entity_handler_get (SlEntityHandler *self, gchar *attrname);
+void sl_entity_handler_set (SlEntityHandler *self, gchar *attrname,
+  gchar *value);
+
+#endif



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