]> git.draconx.ca Git - upkg.git/blobdiff - src/serializable.c
Initial UObject implementation plus a dumb music extractor.
[upkg.git] / src / serializable.c
diff --git a/src/serializable.c b/src/serializable.c
new file mode 100644 (file)
index 0000000..fdc2cc5
--- /dev/null
@@ -0,0 +1,25 @@
+#include <glib-object.h>
+#include "serializable.h"
+#include "upkg.h"
+
+GType upkg_serializable_get_type(void)
+{
+       static GType type = 0;
+       if (type == 0) {
+               static const GTypeInfo info = {
+                       sizeof (UPkgSerializable),
+                       NULL,
+                       NULL,
+               };
+
+               type = g_type_register_static(G_TYPE_INTERFACE,
+                       "UPkgSerializable", &info, 0);
+       }
+       return type;
+}
+
+int upkg_deserialize(GObject *obj, struct upkg_file *f)
+{
+       g_return_val_if_fail(UPKG_IS_SERIALIZABLE(obj), -1);
+       return UPKG_SERIALIZABLE_GET_INTERFACE(obj)->deserialize(obj, f);
+}