comparison libinterp/octave-value/cdef-class.h @ 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 ec769a7ab9fb
children 853e60367cb6 0a5b15007766
comparison
equal deleted inserted replaced
28513:59c6625e0180 28514:fab862fedf85
149 149
150 void mark_as_meta_class (void) { meta = true; } 150 void mark_as_meta_class (void) { meta = true; }
151 151
152 bool is_meta_class (void) const { return meta; } 152 bool is_meta_class (void) const { return meta; }
153 153
154 void doc_string (const std::string& txt) { m_doc_string = txt; }
155
156 std::string doc_string (void) const { return m_doc_string; }
157
154 private: 158 private:
155 159
156 void load_all_methods (void); 160 void load_all_methods (void);
157 161
158 void find_names (std::set<std::string>& names, bool all); 162 void find_names (std::set<std::string>& names, bool all);
171 175
172 // The @-directory were this class is loaded from. 176 // The @-directory were this class is loaded from.
173 // (not used yet) 177 // (not used yet)
174 178
175 std::string directory; 179 std::string directory;
180
181 std::string m_doc_string;
176 182
177 // The methods defined by this class. 183 // The methods defined by this class.
178 184
179 std::map<std::string,cdef_method> method_map; 185 std::map<std::string,cdef_method> method_map;
180 186
372 378
373 void mark_as_meta_class (void) { get_rep ()->mark_as_meta_class (); } 379 void mark_as_meta_class (void) { get_rep ()->mark_as_meta_class (); }
374 380
375 bool is_meta_class (void) const { return get_rep ()->is_meta_class (); } 381 bool is_meta_class (void) const { return get_rep ()->is_meta_class (); }
376 382
383 void doc_string (const std::string& txt) { get_rep ()->doc_string (txt); }
384
385 std::string doc_string (void) const { return get_rep ()->doc_string (); }
386
377 public: 387 public:
378 388
379 enum 389 enum
380 { 390 {
381 property_normal, 391 property_normal,