changeset 28438:55f82d23fe5e stable

new octave_classdef_meta::is_classdef_method function * ov-classdef.h, ov-classdef.cc (octave_classdef_meta::is_classdef_method): New function.
author John W. Eaton <jwe@octave.org>
date Wed, 10 Jun 2020 17:01:31 -0400
parents 8f3aedc5ab4f
children e760fef2829c
files libinterp/octave-value/ov-classdef.cc libinterp/octave-value/ov-classdef.h
diffstat 2 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-classdef.cc	Tue Jun 09 16:48:17 2020 -0400
+++ b/libinterp/octave-value/ov-classdef.cc	Wed Jun 10 17:01:31 2020 -0400
@@ -389,6 +389,25 @@
   return octave::to_ov (octave::lookup_class (cls));
 }
 
+bool octave_classdef_meta::is_classdef_method (const std::string& cname) const
+{
+  bool retval = false;
+
+  if (object.is_method ())
+    {
+      if (cname.empty ())
+        retval = true;
+      else
+        {
+          octave::cdef_method meth (object);
+
+          return meth.is_defined_in_class (cname);
+        }
+    }
+
+  return retval;
+}
+
 bool octave_classdef_meta::is_classdef_constructor (const std::string& cname) const
 {
   bool retval = false;
--- a/libinterp/octave-value/ov-classdef.h	Tue Jun 09 16:48:17 2020 -0400
+++ b/libinterp/octave-value/ov-classdef.h	Wed Jun 10 17:01:31 2020 -0400
@@ -218,6 +218,8 @@
   bool accepts_postfix_index (char type) const
   { return object.meta_accepts_postfix_index (type); }
 
+  bool is_classdef_method (const std::string& cname = "") const;
+
   bool is_classdef_constructor (const std::string& cname = "") const;
 
 private: