changeset 18441:b0aba84cf80f

Support handle to classdef constructor. * ov-classdef.cc (octave_classdef_meta::is_classdef_constructor): New method, makes the meta-object to look like a cdef constructor. * ov-fcn-handle.cc (make_fcn_handle): Handle classdef constructors like legacy class constructors.
author Michael Goffioul <michael.goffioul@gmail.com>
date Sat, 08 Feb 2014 19:17:25 -0500
parents 96a495813047
children 1363d909c577
files libinterp/octave-value/ov-classdef.cc libinterp/octave-value/ov-fcn-handle.cc
diffstat 2 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-classdef.cc	Sat Feb 08 14:44:21 2014 -0800
+++ b/libinterp/octave-value/ov-classdef.cc	Sat Feb 08 19:17:25 2014 -0500
@@ -1129,6 +1129,27 @@
   bool is_postfix_index_handled (char type) const
     { return object.meta_is_postfix_index_handled (type); }
 
+  bool
+  is_classdef_constructor (const std::string& cname = std::string ()) const
+    {
+      bool retval = false;
+
+      if (object.is_class ())
+        {
+          if (cname.empty ())
+            retval = true;
+          else
+            {
+              cdef_class cls (object);
+
+              if (cls.get_name () == cname)
+                retval = true;
+            }
+        }
+
+      return retval;
+    }
+
 private:
   cdef_meta_object object;
 };
--- a/libinterp/octave-value/ov-fcn-handle.cc	Sat Feb 08 14:44:21 2014 -0800
+++ b/libinterp/octave-value/ov-fcn-handle.cc	Sat Feb 08 19:17:25 2014 -0500
@@ -1573,7 +1573,8 @@
   // for any class.
   if (local_funcs && fptr
       && (fptr->is_subfunction () || fptr->is_private_function ()
-          || fptr->is_class_constructor ()))
+          || fptr->is_class_constructor ()
+          || fptr->is_classdef_constructor ()))
     {
       // Locally visible function.
       retval = octave_value (new octave_fcn_handle (f, tnm));