[beast: 15/49] BSE: create C++ pendant for BseObject's of types super, container or item



commit 316a303055327181193678f6eefea1be92188124
Author: Tim Janik <timj gnu org>
Date:   Mon Jun 22 15:24:01 2015 +0200

    BSE: create C++ pendant for BseObject's of types super, container or item

 bse/bseobject.cc |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/bse/bseobject.cc b/bse/bseobject.cc
index 9b215d0..b8df6ed 100644
--- a/bse/bseobject.cc
+++ b/bse/bseobject.cc
@@ -921,18 +921,29 @@ bse_object_new (GType object_type, const gchar *first_property_name, ...)
 GObject*
 bse_object_new_valist (GType object_type, const gchar *first_property_name, va_list var_args)
 {
+  if (!g_type_is_a (object_type, BSE_TYPE_OBJECT)) // e.g. BsePlugin
+    return g_object_new_valist (object_type, first_property_name, var_args);
+  // object_type is derived from BSE_TYPE_OBJECT from here on
   in_bse_object_new++;
   BseObject *object = (BseObject*) g_object_new_valist (object_type, first_property_name, var_args);
   in_bse_object_new--;
   assert (object->cxxobject_ == NULL);
   assert (object->cxxobjref_ == NULL);
   Bse::ObjectImpl *cxxo;
-  if      (object_type == BSE_TYPE_SERVER)
+  if      (g_type_is_a (object_type, BSE_TYPE_SERVER))
     cxxo = new Bse::ServerImpl (object);
-  else if (object_type == BSE_TYPE_PROJECT)
+  else if (g_type_is_a (object_type, BSE_TYPE_PROJECT))
     cxxo = new Bse::ProjectImpl (object);
-  else //  object_type == BSE_TYPE_OBJECT
+  else if (g_type_is_a (object_type, BSE_TYPE_SUPER))
+    cxxo = new Bse::SuperImpl (object);
+  else if (g_type_is_a (object_type, BSE_TYPE_CONTAINER))
+    cxxo = new Bse::ContainerImpl (object);
+  else if (g_type_is_a (object_type, BSE_TYPE_ITEM))
+    cxxo = new Bse::ItemImpl (object);
+  else if (g_type_is_a (object_type, BSE_TYPE_OBJECT))
     cxxo = new Bse::ObjectImpl (object);
+  else
+    assert (!"reached");
   assert (object->cxxobject_ == cxxo);
   assert (object->cxxobjref_ == NULL);
   object->cxxobjref_ = new Bse::ObjectImplP (cxxo); // shared_ptr that allows enable_shared_from_this


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