All pastes #632136 Raw Edit

Someone

public text v1 · immutable
#632136 ·published 2007-07-24 16:39 UTC
rendered paste body
Index: src/value.cpp
===================================================================
--- src/value.cpp       (revision 82573)
+++ src/value.cpp       (working copy)
@@ -236,6 +236,14 @@
        memcpy (u.matrix, matrix, sizeof (Matrix));
 }
 
+Value::Value (Type::Kind k, gpointer npobj)
+{
+       Init ();
+       g_assert (k == Type::NPOBJ);
+
+       u.npobj = npobj;
+}
+
 void
 Value::FreeValue ()
 {
Index: src/value.h.in
===================================================================
--- src/value.h.in      (revision 82573)
+++ src/value.h.in      (working copy)
@@ -54,7 +54,8 @@
        Value (Point *points, int count);
        Value (double *values, int count);
        Value (Matrix* matrix);
-
+       Value (Type::Kind k, gpointer npobj);
+
        ~Value ();
 
        bool operator!= (const Value &v) const
@@ -95,7 +96,7 @@
        Duration*       AsDuration ()   { checked_get_exact (Type::DURATION, NULL, u.duration); }
        KeyTime*        AsKeyTime ()    { checked_get_exact (Type::KEYTIME, NULL, u.keytime); }
        Matrix*         AsMatrix ()     { checked_get_exact (Type::MATRIX, NULL, u.matrix); }
-
+
        /* nullable primitives (all but bool) */
        double*         AsNullableDouble ()     { checked_get_exact (Type::DOUBLE, NULL, &u.d); }
        guint64*        AsNullableUint64 ()     { checked_get_exact (Type::UINT64, NULL, &u.ui64); }
@@ -129,6 +130,7 @@
                PointArray *point_array;
                DoubleArray *double_array;
                Matrix* matrix;
+               gpointer npobj;
        } u;
 
 
Index: plugin/plugin-class.cpp
===================================================================
--- plugin/plugin-class.cpp     (revision 82529)
+++ plugin/plugin-class.cpp     (working copy)
@@ -250,9 +250,8 @@
                *result = new Value (Type::DEPENDENCY_OBJECT);
                break;
        case NPVariantType_Object:
-               DEBUG_WARN_NOTIMPLEMENTED ("object variant type");
-               *result = NULL;
-
+               *result = new Value (Type::NPOBJ, NPVARIANT_TO_OBJECT (*v));
+               NPN_RetainObject (NPVARIANT_TO_OBJECT (*v));
                break;
        }
 }