diff src/ov-usr-fcn.h @ 11220:883b9308353c

allow class function to be called from methods as well as constructors
author John W. Eaton <jwe@octave.org>
date Wed, 10 Nov 2010 00:54:34 -0500
parents 1b2fcd122c6a
children 40f311a69417
line wrap: on
line diff
--- a/src/ov-usr-fcn.h	Tue Nov 09 21:02:44 2010 -0800
+++ b/src/ov-usr-fcn.h	Wed Nov 10 00:54:34 2010 -0500
@@ -251,11 +251,19 @@
 
   void mark_as_class_constructor (void) { class_constructor = true; }
 
-  bool is_class_constructor (void) const { return class_constructor; }
+  bool is_class_constructor (const std::string& cname = std::string ()) const
+    {
+      return class_constructor
+        ? (cname.empty () ? true : cname == dispatch_class ()) : false;
+    }
 
   void mark_as_class_method (void) { class_method = true; }
 
-  bool is_class_method (void) const { return class_method; }
+  bool is_class_method (const std::string& cname = std::string ()) const
+    {
+      return class_method
+        ? (cname.empty () ? true : cname == dispatch_class ()) : false;
+    }
 
   octave_value subsref (const std::string& type,
                         const std::list<octave_value_list>& idx)