diff libinterp/octave-value/cdef-class.h @ 26950:fbb318c371db

methods: return classdef constructors in list (bug #55858) * cdev-class.h, cdef-class.cc (cdef_class::get_methods, cdef_class::get_method_map, cdef_class:cdef_class_rep::get_methods, cdef_class::cdef_class_rep::get_methods_map): New parameter, INCLUDE_CTOR. (cdef_class::cdef_class_rep::find_methods): New parameter, INCLUDE_CTOR. If TRUE, return class constructor in the list. * ov-classdef.cc (Fmethods): Call get_method_map with INCLUDE_CTOR parameter set to true.
author John W. Eaton <jwe@octave.org>
date Wed, 20 Mar 2019 16:20:10 +0000
parents 568c2ab2782d
children de826e69a5ea
line wrap: on
line diff
--- a/libinterp/octave-value/cdef-class.h	Wed Mar 20 03:54:24 2019 +0000
+++ b/libinterp/octave-value/cdef-class.h	Wed Mar 20 16:20:10 2019 +0000
@@ -80,9 +80,10 @@
 
       void install_method (const cdef_method& meth);
 
-      Cell get_methods (void);
+      Cell get_methods (bool include_ctor);
 
-      std::map<std::string, cdef_method> get_method_map (bool only_inherited);
+      std::map<std::string, cdef_method>
+      get_method_map (bool only_inherited, bool include_ctor);
 
       cdef_property find_property (const std::string& nm);
 
@@ -158,7 +159,7 @@
                             int mode = 0);
 
       void find_methods (std::map<std::string, cdef_method>& meths,
-                         bool only_inherited);
+                         bool only_inherited, bool include_ctor = false);
 
       cdef_class wrap (void)
       {
@@ -256,12 +257,15 @@
       get_rep ()->install_method (meth);
     }
 
-    Cell get_methods (void) { return get_rep ()->get_methods (); }
+    Cell get_methods (bool include_ctor = false)
+    {
+      return get_rep ()->get_methods (include_ctor);
+    }
 
     std::map<std::string, cdef_method>
-    get_method_map (bool only_inherited = false)
+    get_method_map (bool only_inherited = false, bool include_ctor = false)
     {
-      return get_rep ()->get_method_map (only_inherited);
+      return get_rep ()->get_method_map (only_inherited, include_ctor);
     }
 
     cdef_property find_property (const std::string& nm);