GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ov-classdef.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2012-2023 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if defined (HAVE_CONFIG_H)
27 # include "config.h"
28 #endif
29 
30 #include <algorithm>
31 #include <iomanip>
32 
33 #include "cdef-class.h"
34 #include "cdef-method.h"
35 #include "cdef-package.h"
36 #include "cdef-property.h"
37 #include "cdef-utils.h"
38 #include "defun.h"
39 #include "errwarn.h"
40 #include "interpreter-private.h"
41 #include "load-path.h"
42 #include "ov-classdef.h"
43 #include "ov-fcn-handle.h"
44 #include "ov-typeinfo.h"
45 #include "ov-usr-fcn.h"
46 #include "parse.h"
47 #include "pr-output.h"
48 #include "pt-eval.h"
49 #include "pt-misc.h"
50 #include "oct-lvalue.h"
51 
52 static bool
54 {
56 
57  return (ctx.ok () && octave::is_superclass (ctx, cls));
58 }
59 
60 int octave_classdef::t_id (-1);
61 
62 const std::string octave_classdef::t_name ("object");
63 
64 void
65 octave_classdef::register_type (octave::type_info& ti)
66 {
67  t_id = ti.register_type (octave_classdef::t_name, "<unknown>",
68  octave_value (new octave_classdef ()));
69 }
70 
72 octave_classdef::subsref (const std::string& type,
73  const std::list<octave_value_list>& idx,
74  int nargout)
75 {
76  std::size_t skip = 0;
77  octave_value_list retval;
78 
79  octave::cdef_class cls = m_object.get_class ();
80 
81  if (! in_class_method (cls) && ! called_from_builtin ())
82  {
83  octave::cdef_method meth = cls.find_method ("subsref");
84 
85  if (meth.ok ())
86  {
87  octave_value_list args;
88 
89  args(1) = make_idx_args (type, idx, "subsref");
90 
91  count++;
92  args(0) = octave_value (this);
93 
94  retval = meth.execute (args, nargout, true, "subsref");
95 
96  return retval;
97  }
98  }
99 
100  // At this point, the default subsref mechanism must be used.
101 
102  retval = m_object.subsref (type, idx, nargout, skip, octave::cdef_class ());
103 
104  if (type.length () > skip && idx.size () > skip)
105  retval = retval(0).next_subsref (nargout, type, idx, skip);
106 
107  return retval;
108 }
109 
111 octave_classdef::subsref (const std::string& type,
112  const std::list<octave_value_list>& idx,
113  bool auto_add)
114 {
115  std::size_t skip = 0;
116  octave_value_list retval;
117 
118  // This variant of subsref is used to create temporary values when doing
119  // assignment with multi-level indexing. AFAIK this is only used for internal
120  // purpose (not sure we should even implement this).
121 
122  octave::cdef_class cls = m_object.get_class ();
123 
124  if (! in_class_method (cls))
125  {
126  octave::cdef_method meth = cls.find_method ("subsref");
127 
128  if (meth.ok ())
129  {
130  octave_value_list args;
131 
132  args(1) = make_idx_args (type, idx, "subsref");
133 
134  count++;
135  args(0) = octave_value (this);
136 
137  retval = meth.execute (args, 1, true, "subsref");
138 
139  return retval.length () > 0 ? retval(0) : octave_value ();
140  }
141  }
142 
143  retval = m_object.subsref (type, idx, 1, skip,
144  octave::cdef_class (), auto_add);
145 
146  if (type.length () > skip && idx.size () > skip)
147  retval = retval(0).next_subsref (1, type, idx, skip);
148 
149  return retval.length () > 0 ? retval(0) : octave_value ();
150 }
151 
153 octave_classdef::subsasgn (const std::string& type,
154  const std::list<octave_value_list>& idx,
155  const octave_value& rhs)
156 {
157  octave_value retval;
158 
159  octave::cdef_class cls = m_object.get_class ();
160 
161  if (! in_class_method (cls) && ! called_from_builtin ())
162  {
163  octave::cdef_method meth = cls.find_method ("subsasgn");
164 
165  if (meth.ok ())
166  {
167  octave_value_list args;
168 
169  args(1) = make_idx_args (type, idx, "subsasgn");
170 
171  count++;
172  args(0) = octave_value (this);
173  args(2) = rhs;
174 
175  octave_value_list retlist;
176 
177  retlist = meth.execute (args, 1, true, "subsasgn");
178 
179  if (retlist.empty ())
180  error ("overloaded method 'subsasgn' did not return any value");
181 
182  retval = retlist(0);
183  }
184  }
185 
186  if (! retval.is_defined ())
187  retval = m_object.subsasgn (type, idx, rhs);
188 
189  return retval;
190 }
191 
193 octave_classdef::undef_subsasgn (const std::string& type,
194  const std::list<octave_value_list>& idx,
195  const octave_value& rhs)
196 {
197  if (type.length () == 1 && type[0] == '(')
198  {
199  m_object = m_object.make_array ();
200 
201  return subsasgn (type, idx, rhs);
202  }
203  else
204  return octave_base_value::undef_subsasgn (type, idx, rhs);
205 
206  return octave_value ();
207 }
208 
209 Matrix
211 {
212  octave::cdef_class cls = m_object.get_class ();
213 
214  if (! in_class_method (cls) && ! called_from_builtin ())
215  {
216  octave::cdef_method meth = cls.find_method ("size");
217 
218  if (meth.ok ())
219  {
220  count++;
221  octave_value_list args (1, octave_value (this));
222 
223  octave_value_list lv = meth.execute (args, 1, true, "size");
224  if (lv.length () <= 0
225  || ! lv(0).is_matrix_type () || ! lv(0).dims ().isvector ())
226  error ("%s.size: invalid return value", class_name ().c_str ());
227 
228  return lv(0).matrix_value ();
229  }
230  }
231 
232  return octave_base_value::size ();
233 }
234 
237 {
238  octave_idx_type retval = -1;
239 
240  octave::cdef_class cls = m_object.get_class ();
241 
242  if (! in_class_method (cls) && ! called_from_builtin ())
243  {
244  octave::cdef_method meth = cls.find_method ("numel");
245 
246  if (meth.ok ())
247  {
248  octave_value_list args (idx.length () + 1, octave_value ());
249 
250  count++;
251  args(0) = octave_value (this);
252 
253  for (octave_idx_type i = 0; i < idx.length (); i++)
254  args(i+1) = idx(i);
255 
256  // Temporarily set lvalue list of current statement to NULL, to avoid
257  // using that list for the execution of the method "numel"
258  octave::interpreter& interp = octave::__get_interpreter__ ();
259  octave::tree_evaluator& tw = interp.get_evaluator();
260 
261  octave::unwind_action act ([&tw] (const std::list<octave::octave_lvalue> *lvl)
262  {
263  tw.set_lvalue_list (lvl);
264  }, tw.lvalue_list ());
265  tw.set_lvalue_list (nullptr);
266 
267  octave_value_list lv = meth.execute (args, 1, true, "numel");
268  if (lv.length () != 1 || ! lv(0).is_scalar_type ())
269  error ("@%s/numel: invalid return value", cls.get_name ().c_str ());
270 
271  retval = lv(0).idx_type_value (true);
272 
273  return retval;
274  }
275  }
276 
277  retval = octave_base_value::xnumel (idx);
278 
279  return retval;
280 }
281 
282 void
283 octave_classdef::print (std::ostream& os, bool)
284 {
285  print_raw (os);
286 }
287 
288 void
289 octave_classdef::print_raw (std::ostream& os, bool) const
290 {
291  octave::cdef_class cls = m_object.get_class ();
292 
293  if (cls.ok ())
294  {
295  bool is_array = m_object.is_array ();
296 
298 
299  indent (os);
300  os << class_name () << " object";
301  if (is_array)
302  os << " array";
303  os << " with properties:";
304  newline (os);
305  if (! Vcompact_format)
306  newline (os);
307 
309 
310  std::map<std::string, octave::cdef_property> property_map
311  = cls.get_property_map ();
312 
313  std::size_t max_len = 0;
314  for (const auto& pname_prop : property_map)
315  {
316  // FIXME: this loop duplicates a significant portion of the
317  // loop below and the loop in Fproperties.
318 
319  const octave::cdef_property& prop = pname_prop.second;
320 
321  const std::string nm = prop.get_name ();
322 
323  octave_value acc = prop.get ("GetAccess");
324 
325  if (! acc.is_string () || acc.string_value () != "public")
326  continue;
327 
328  octave_value hid = prop.get ("Hidden");
329 
330  if (hid.bool_value ())
331  continue;
332 
333  std::size_t sz = nm.size ();
334 
335  if (sz > max_len)
336  max_len = sz;
337  }
338 
339  for (auto& pname_prop : property_map)
340  {
341  const octave::cdef_property& prop = pname_prop.second;
342 
343  const std::string nm = prop.get_name ();
344 
345  octave_value acc = prop.get ("GetAccess");
346 
347  if (! acc.is_string () || acc.string_value () != "public")
348  continue;
349 
350  octave_value hid = prop.get ("Hidden");
351 
352  if (hid.bool_value ())
353  continue;
354 
355  indent (os);
356 
357  if (is_array)
358  os << " " << nm;
359  else
360  {
361  octave_value val = prop.get_value (m_object, false);
362  dim_vector dims = val.dims ();
363 
364  os << std::setw (max_len+2) << nm << ": ";
365  if (val.is_string ())
366  os << val.string_value ();
367  else if (val.islogical ())
368  os << val.bool_value ();
369  else
370  os << "[" << dims.str () << " " << val.class_name () << "]";
371  }
372 
373  newline (os);
374  }
375 
378  }
379 }
380 
381 bool
382 octave_classdef::is_instance_of (const std::string& cls_name) const
383 {
384  octave::cdef_class cls = octave::lookup_class (cls_name, false, false);
385 
386  if (cls.ok ())
387  return is_superclass (cls, m_object.get_class ());
388 
389  return false;
390 }
391 
393 octave_classdef::superclass_ref (const std::string& meth,
394  const std::string& cls)
395 {
396  return octave_value (new octave_classdef_superclass_ref (meth, cls));
397 }
398 
400 octave_classdef::metaclass_query (const std::string& cls)
401 {
402  return octave::to_ov (octave::lookup_class (cls));
403 }
404 
405 bool octave_classdef_meta::is_classdef_method (const std::string& cname) const
406 {
407  bool retval = false;
408 
409  if (m_object.is_method ())
410  {
411  if (cname.empty ())
412  retval = true;
413  else
414  {
415  octave::cdef_method meth (m_object);
416 
417  return meth.is_defined_in_class (cname);
418  }
419  }
420 
421  return retval;
422 }
423 
424 bool octave_classdef_meta::is_classdef_constructor (const std::string& cname) const
425 {
426  bool retval = false;
427 
428  if (m_object.is_class ())
429  {
430  if (cname.empty ())
431  retval = true;
432  else
433  {
435 
436  if (cls.get_name () == cname)
437  retval = true;
438  }
439  }
440 
441  return retval;
442 }
443 
444 std::string octave_classdef_meta::doc_string (const std::string& meth_name) const
445 {
446  if (m_object.is_class ())
447  {
449 
450  if (meth_name.empty ())
451  return cls.doc_string ();
452 
453  octave::cdef_method cdef_meth = cls.find_method (meth_name);
454 
455  if (cdef_meth.ok ())
456  return cdef_meth.get_doc_string ();
457  }
458 
459  return "";
460 }
461 
462 std::string octave_classdef_meta::file_name (void) const
463 {
464  if (m_object.is_class ())
465  {
467 
468  return cls.file_name ();
469  }
470 
471  return "";
472 }
473 
475 octave_classdef_superclass_ref::execute (octave::tree_evaluator& tw,
476  int nargout,
477  const octave_value_list& idx)
478 {
479  octave_value_list retval;
480 
481  std::string meth_name;
482  bool in_constructor;
483  octave::cdef_class ctx;
484 
485  ctx = octave::get_class_context (meth_name, in_constructor);
486 
487  if (! ctx.ok ())
488  error ("superclass calls can only occur in methods or constructors");
489 
490  std::string mname = m_method_name;
491  std::string cname = m_class_name;
492 
493  // CLS is the superclass. The lookup_class function handles
494  // pkg.class names.
495 
497 
498  if (in_constructor)
499  {
500  if (! is_direct_superclass (cls, ctx))
501  error ("'%s' is not a direct superclass of '%s'",
502  cname.c_str (), ctx.get_name ().c_str ());
503 
504  if (! is_constructed_object (tw, mname))
505  error ("cannot call superclass constructor with variable '%s'",
506  mname.c_str ());
507 
508  octave_value sym = tw.varval (mname);
509 
510  cls.run_constructor (octave::to_cdef_ref (sym), idx);
511 
512  retval(0) = sym;
513  }
514  else
515  {
516  std::size_t pos = mname.find ('.');
517 
519 
520  if (pos != std::string::npos)
521  {
522  // We are looking at obj.meth.
523 
524  std::string oname = m_method_name.substr (0, pos);
525  mname = mname.substr (pos + 1);
526 
527  octave_value tval = tw.varval (oname);
528 
529  // FIXME: Can we only call superclass methods on the current
530  // object? If so, and we are looking at something like
531  //
532  // function meth (obj, ...)
533  // obj.meth@superclass (...)
534  //
535  // Do we need to verify that the object that was passed to
536  // meth is the same as the object we find when looking up
537  // obj in the expression obj.meth? If so, what is the right
538  // way to perform that check?
539 
540  if (tval.is_classdef_object ())
541  {
542  octave_classdef *cdobj = tval.classdef_object_value ();
543 
544  obj = cdobj->get_object ();
545  }
546  }
547 
548  if (mname != meth_name)
549  error ("method name mismatch ('%s' != '%s')",
550  mname.c_str (), meth_name.c_str ());
551 
552  if (! is_strict_superclass (cls, ctx))
553  error ("'%s' is not a superclass of '%s'",
554  cname.c_str (), ctx.get_name ().c_str ());
555 
556  // I see 2 possible implementations here:
557  // 1) use cdef_object::subsref with a different class
558  // context; this avoids duplicating code, but
559  // assumes the object is always the first argument
560  // 2) lookup the method manually and call
561  // cdef_method::execute; this duplicates part of
562  // logic in cdef_object::subsref, but avoid the
563  // assumption of 1)
564  // Not being sure about the assumption of 1), I
565  // go with option 2) for the time being.
566 
567  octave::cdef_method meth = cls.find_method (meth_name, false);
568 
569  if (! meth.ok ())
570  error ("no method '%s' found in superclass '%s'",
571  meth_name.c_str (), cname.c_str ());
572 
573  retval = (obj.ok ()
574  ? meth.execute (obj, idx, nargout, true, meth_name)
575  : meth.execute (idx, nargout, true, meth_name));
576  }
577 
578  return retval;
579 }
580 
582  const std::string& nm)
583 {
584  octave_function *of = tw.current_function ();
585 
586  if (of->is_classdef_constructor ())
587  {
588  octave_user_function *uf = of->user_function_value (true);
589 
590  if (uf)
591  {
592  octave::tree_parameter_list *ret_list = uf->return_list ();
593 
594  if (ret_list && ret_list->length () == 1)
595  return (ret_list->front ()->name () == nm);
596  }
597  }
598 
599  return false;
600 }
601 
603 
604 DEFUN (__meta_get_package__, args, ,
605  doc: /* -*- texinfo -*-
606 @deftypefn {} {@var{pkg} =} __meta_get_package__ (@var{pkg_name})
607 Undocumented internal function.
608 @end deftypefn */)
609 {
610  if (args.length () != 1)
611  print_usage ();
612 
613  std::string cname = args(0).xstring_value ("PKG_NAME must be a string");
614 
615  return to_ov (lookup_package (cname));
616 }
617 
618 DEFUN (metaclass, args, ,
619  doc: /* -*- texinfo -*-
620 @deftypefn {} {@var{metaclass_obj} =} metaclass (obj)
621 Return the meta.class object corresponding to the class of @var{obj}.
622 @end deftypefn */)
623 {
624  if (args.length () != 1)
625  print_usage ();
626 
627  cdef_object obj = to_cdef (args(0));
628 
629  return to_ov (obj.get_class ());
630 }
631 
632 // FIXME: What about dynamic properties if obj is a scalar, or the
633 // properties of the class of obj if obj is an array? Probably there
634 // should be a function to do this job so that the DEFUN is just a
635 // simple wrapper.
636 
637 DEFUN (properties, args, nargout,
638  doc: /* -*- texinfo -*-
639 @deftypefn {} {} properties (@var{obj})
640 @deftypefnx {} {} properties (@var{class_name})
641 @deftypefnx {} {@var{proplist} =} properties (@dots{})
642 Display or return the public properties for the classdef object @var{obj} or
643 the named class @var{class_name}.
644 
645 If an output value is requested, return the list of property names in a cell
646 array.
647 
648 Programming Note: Property names are returned if the @code{GetAccess} attribute
649 is public and if the @code{Hidden} attribute is false.
650 @seealso{methods}
651 @end deftypefn */)
652 {
653  if (args.length () != 1)
654  print_usage ();
655 
656  octave_value arg = args(0);
657 
658  std::string class_name;
659 
660  if (arg.isobject ())
661  class_name = arg.class_name ();
662  else if (arg.is_string ())
663  class_name = arg.string_value ();
664  else
665  err_wrong_type_arg ("properties", arg);
666 
667  cdef_class cls;
668 
669  cls = lookup_class (class_name, false, true);
670 
671  if (! cls.ok ())
672  error ("invalid class: %s", class_name.c_str ());
673 
674  std::map<std::string, cdef_property> property_map =
675  cls.get_property_map ();
676 
677  std::list<std::string> property_names;
678 
679  for (const auto& pname_prop : property_map)
680  {
681  // FIXME: this loop duplicates a significant portion of the loops
682  // in octave_classdef::print_raw.
683 
684  const cdef_property& prop = pname_prop.second;
685 
686  std::string nm = prop.get_name ();
687 
688  octave_value acc = prop.get ("GetAccess");
689 
690  if (! acc.is_string () || acc.string_value () != "public")
691  continue;
692 
693  octave_value hid = prop.get ("Hidden");
694 
695  if (hid.bool_value ())
696  continue;
697 
698  property_names.push_back (nm);
699  }
700 
701  if (nargout > 0)
702  return octave_value (Cell (string_vector (property_names)));
703 
704  octave_stdout << "properties for class " << class_name << ":\n\n";
705 
706  for (const auto& nm : property_names)
707  octave_stdout << " " << nm << "\n";
708 
709  octave_stdout << std::endl;
710 
711  return octave_value ();
712 }
713 
714 /*
715 %!assert (properties ("inputParser"),
716 %! {"CaseSensitive"; "FunctionName"; "KeepUnmatched";
717 %! "Parameters"; "PartialMatching"; "Results";
718 %! "StructExpand"; "Unmatched"; "UsingDefaults"});
719 */
720 
721 // FIXME: Need to implement the -full option.
722 
723 DEFMETHOD (__methods__, interp, args, ,
724  doc: /* -*- texinfo -*-
725 @deftypefn {} {@var{mtds} =} __methods__ (@var{obj})
726 @deftypefnx {} {@var{mtds} =} __methods__ ("classname")
727 Implement @code{methods} for Octave class objects and classnames.
728 @seealso{methods}
729 @end deftypefn */)
730 {
731  // Input validation has already been done in methods.m.
732  octave_value arg = args(0);
733 
734  std::string class_name;
735 
736  if (arg.isobject ())
737  class_name = arg.class_name ();
738  else if (arg.is_string ())
739  class_name = arg.string_value ();
740  else
741  err_wrong_type_arg ("__methods__", arg);
742 
743  string_vector sv;
744 
745  cdef_class cls = lookup_class (class_name, false, true);
746 
747  if (cls.ok ())
748  {
749  // Find methods for classdef objects.
750  std::map<std::string, cdef_method> method_map
751  = cls.get_method_map (false, true);
752 
753  std::list<std::string> method_names;
754 
755  for (const auto& nm_mthd : method_map)
756  {
757  std::string nm = nm_mthd.first;
758 
759  method_names.push_back (nm);
760  }
761 
762  sv = string_vector (method_names);
763  }
764  else
765  {
766  // Find methods for legacy @CLASS objects.
767  load_path& lp = interp.get_load_path ();
768 
769  sv = string_vector (lp.methods (class_name));
770  }
771 
772  return ovl (Cell (sv));
773 }
774 
776 
bool isvector(const dim_vector &dim)
Definition: Array-util.cc:140
OCTAVE_END_NAMESPACE(octave)
class OCTINTERP_API cdef_object
Definition: cdef-fwd.h:34
class OCTINTERP_API cdef_class
Definition: cdef-fwd.h:33
bool is_superclass(const cdef_class &clsa, const cdef_class &clsb, bool allow_equal, int max_depth)
Definition: cdef-utils.cc:200
bool is_strict_superclass(const cdef_class &clsa, const cdef_class &clsb)
Definition: cdef-utils.cc:226
cdef_object to_cdef(const octave_value &val)
Definition: cdef-utils.cc:143
cdef_object & to_cdef_ref(const octave_value &val)
Definition: cdef-utils.cc:152
cdef_class get_class_context(std::string &name, bool &in_constructor)
Definition: cdef-utils.cc:247
cdef_class lookup_class(const std::string &name, bool error_if_not_found, bool load_if_not_found)
Definition: cdef-utils.cc:80
octave_value to_ov(const cdef_object &obj)
Definition: cdef-utils.cc:128
cdef_package lookup_package(const std::string &name, bool error_if_not_found, bool load_if_not_found)
Definition: cdef-utils.cc:238
bool is_direct_superclass(const cdef_class &clsa, const cdef_class &clsb)
Definition: cdef-utils.cc:232
Definition: Cell.h:43
Definition: dMatrix.h:42
std::map< std::string, cdef_property > get_property_map(int mode=property_normal)
Definition: cdef-class.h:301
std::map< std::string, cdef_method > get_method_map(bool only_inherited=false, bool include_ctor=false)
Definition: cdef-class.h:283
bool ok(void) const
Definition: cdef-object.h:312
OCTINTERP_API cdef_class get_class(void) const
Definition: cdef-object.cc:183
octave_value get(const std::string &pname) const
Definition: cdef-object.h:268
std::string get_name(void) const
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:94
OCTAVE_API std::string str(char sep='x') const
Definition: dim-vector.cc:68
std::list< std::string > methods(const std::string &class_name, const std::string &pack_name="")
Definition: load-path.h:95
octave::refcount< octave_idx_type > count
Definition: ov-base.h:916
void decrement_indent_level(void) const
Definition: ov-base.h:900
void increment_indent_level(void) const
Definition: ov-base.h:897
OCTINTERP_API void indent(std::ostream &os) const
Definition: ov-base.cc:1369
OCTINTERP_API void newline(std::ostream &os) const
Definition: ov-base.cc:1388
virtual Matrix size(void)
Definition: ov-base.cc:184
virtual bool is_matrix_type(void) const
Definition: ov-base.h:491
virtual bool is_scalar_type(void) const
Definition: ov-base.h:489
virtual octave_idx_type xnumel(const octave_value_list &)
Definition: ov-base.cc:194
virtual octave_user_function * user_function_value(bool silent=false)
Definition: ov-base.cc:949
virtual octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Definition: ov-base.cc:305
static void register_type(void)
Definition: ov-base.cc:99
friend class octave_value
Definition: ov-base.h:263
OCTINTERP_API bool is_classdef_method(const std::string &cname="") const
Definition: ov-classdef.cc:405
octave::cdef_meta_object m_object
Definition: ov-classdef.h:239
OCTINTERP_API bool is_classdef_constructor(const std::string &cname="") const
Definition: ov-classdef.cc:424
OCTINTERP_API std::string doc_string(const std::string &meth_name) const
Definition: ov-classdef.cc:444
OCTINTERP_API std::string file_name(void) const
Definition: ov-classdef.cc:462
OCTINTERP_API bool is_constructed_object(octave::tree_evaluator &tw, const std::string &nm)
Definition: ov-classdef.cc:581
OCTINTERP_API octave_value_list execute(octave::tree_evaluator &tw, int nargout, const octave_value_list &idx)
Definition: ov-classdef.cc:475
OCTINTERP_API void print(std::ostream &os, bool pr_as_read_syntax=false)
Definition: ov-classdef.cc:283
OCTINTERP_API octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Definition: ov-classdef.cc:153
dim_vector dims(void) const
Definition: ov-classdef.h:131
OCTINTERP_API octave_value_list subsref(const std::string &type, const std::list< octave_value_list > &idx, int nargout)
Definition: ov-classdef.cc:72
OCTINTERP_API Matrix size(void)
Definition: ov-classdef.cc:210
static const std::string t_name
Definition: ov-classdef.h:167
octave::cdef_object get_object(void) const
Definition: ov-classdef.h:75
OCTINTERP_API bool is_instance_of(const std::string &cls_name) const
Definition: ov-classdef.cc:382
OCTINTERP_API octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Definition: ov-classdef.cc:193
octave::cdef_object m_object
Definition: ov-classdef.h:163
static OCTINTERP_API octave_value metaclass_query(const std::string &cls)
Definition: ov-classdef.cc:400
OCTINTERP_API octave_idx_type xnumel(const octave_value_list &)
Definition: ov-classdef.cc:236
static OCTINTERP_API octave_value superclass_ref(const std::string &meth, const std::string &cls)
Definition: ov-classdef.cc:393
OCTINTERP_API void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
Definition: ov-classdef.cc:289
static int t_id
Definition: ov-classdef.h:165
std::string class_name(void) const
Definition: ov-classdef.h:154
virtual bool is_classdef_constructor(const std::string &="") const
Definition: ov-fcn.h:127
octave::tree_parameter_list * return_list(void)
Definition: ov-usr-fcn.h:396
bool empty(void) const
Definition: ovl.h:115
octave_idx_type length(void) const
Definition: ovl.h:113
bool is_classdef_object(void) const
Definition: ov.h:700
bool bool_value(bool warn=false) const
Definition: ov.h:930
bool is_string(void) const
Definition: ov.h:682
bool is_defined(void) const
Definition: ov.h:637
Matrix size(void)
Definition: ov.h:511
std::string class_name(void) const
Definition: ov.h:1454
std::string string_value(bool force=false) const
Definition: ov.h:1019
bool isobject(void) const
Definition: ov.h:709
bool islogical(void) const
Definition: ov.h:780
dim_vector dims(void) const
Definition: ov.h:586
OCTINTERP_API octave_classdef * classdef_object_value(bool silent=false) const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
OCTINTERP_API void print_usage(void)
Definition: defun-int.h:72
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
Definition: defun.h:111
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
Definition: defun.h:56
void error(const char *fmt,...)
Definition: error.cc:979
void err_wrong_type_arg(const char *name, const char *s)
Definition: errwarn.cc:166
interpreter & __get_interpreter__(void)
T::properties & properties(graphics_object obj)
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
octave_value make_idx_args(const std::string &type, const std::list< octave_value_list > &idx, const std::string &who)
Definition: ov-base.cc:1461
bool called_from_builtin(void)
Definition: ov-base.cc:1524
static bool in_class_method(const octave::cdef_class &cls)
Definition: ov-classdef.cc:53
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
Definition: ovl.h:211
#define octave_stdout
Definition: pager.h:314
bool Vcompact_format
Definition: pr-output.cc:102