comparison libinterp/octave-value/ov-classdef.cc @ 28514:fab862fedf85 stable

allow help to find docstrings for classdef classes and methods (bug #43047) * help.cc (help_system::raw_help_from_symbol_table): Also find docstrings from classdef meta objects (both classes and methods). * cdef-class.h, cdef-class.cc (cdef_class::cdef_class_rep, cdef_class): Store docstring for class and provide access. * ov-classdef.h, ov-classdef.cc (octave_classdef_meta::doc_string): New function to provide access to doc strings for classdef objects and methods. * ov-fcn.h (octave_function::doc_string): Now virtual. New argument for method name.
author John W. Eaton <jwe@octave.org>
date Fri, 29 May 2020 10:57:04 -0400
parents 55f82d23fe5e
children 49f4d7814760
comparison
equal deleted inserted replaced
28513:59c6625e0180 28514:fab862fedf85
426 } 426 }
427 427
428 return retval; 428 return retval;
429 } 429 }
430 430
431 std::string octave_classdef_meta::doc_string (const std::string& meth_name) const
432 {
433 if (object.is_class ())
434 {
435 octave::cdef_class cls (object);
436
437 if (meth_name.empty ())
438 return cls.doc_string ();
439
440 octave_value ov_meth = cls.get_method (meth_name);
441
442 if (ov_meth.is_defined ())
443 {
444 octave_function *fcn = ov_meth.function_value ();
445
446 if (fcn)
447 return fcn->doc_string ();
448 }
449 }
450
451 return "";
452 }
453
431 octave_value_list 454 octave_value_list
432 octave_classdef_superclass_ref::execute (octave::tree_evaluator& tw, 455 octave_classdef_superclass_ref::execute (octave::tree_evaluator& tw,
433 int nargout, 456 int nargout,
434 const octave_value_list& idx) 457 const octave_value_list& idx)
435 { 458 {