# HG changeset patch # User Michael Goffioul # Date 1391905045 18000 # Node ID b0aba84cf80fb3958d696ee8e685059aeaf3c32c # Parent 96a4958130471a6ecaeb7e36d61a60313dcae4e4 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. diff -r 96a495813047 -r b0aba84cf80f libinterp/octave-value/ov-classdef.cc --- 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; }; diff -r 96a495813047 -r b0aba84cf80f libinterp/octave-value/ov-fcn-handle.cc --- 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));