GNU Octave 7.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-2022 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
52static bool
54{
56
57 return (ctx.ok () && octave::is_superclass (ctx, cls));
58}
59
61
62const std::string octave_classdef::t_name ("object");
63
64void
65octave_classdef::register_type (octave::type_info& ti)
66{
67 t_id = ti.register_type (octave_classdef::t_name, "<unknown>",
69}
70
72octave_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
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 {
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
111octave_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
123
124 if (! in_class_method (cls))
125 {
126 octave::cdef_method meth = cls.find_method ("subsref");
127
128 if (meth.ok ())
129 {
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, octave::cdef_class (), auto_add);
144
145 if (type.length () > skip && idx.size () > skip)
146 retval = retval(0).next_subsref (1, type, idx, skip);
147
148 return retval.length () > 0 ? retval(0) : octave_value ();
149}
150
152octave_classdef::subsasgn (const std::string& type,
153 const std::list<octave_value_list>& idx,
154 const octave_value& rhs)
155{
156 octave_value retval;
157
159
160 if (! in_class_method (cls) && ! called_from_builtin ())
161 {
162 octave::cdef_method meth = cls.find_method ("subsasgn");
163
164 if (meth.ok ())
165 {
167
168 args(1) = make_idx_args (type, idx, "subsasgn");
169
170 count++;
171 args(0) = octave_value (this);
172 args(2) = rhs;
173
174 octave_value_list retlist;
175
176 retlist = meth.execute (args, 1, true, "subsasgn");
177
178 if (retlist.empty ())
179 error ("overloaded method 'subsasgn' did not return any value");
180
181 retval = retlist(0);
182 }
183 }
184
185 if (! retval.is_defined ())
186 retval = m_object.subsasgn (type, idx, rhs);
187
188 return retval;
189}
190
192octave_classdef::undef_subsasgn (const std::string& type,
193 const std::list<octave_value_list>& idx,
194 const octave_value& rhs)
195{
196 if (type.length () == 1 && type[0] == '(')
197 {
199
200 return subsasgn (type, idx, rhs);
201 }
202 else
203 return octave_base_value::undef_subsasgn (type, idx, rhs);
204
205 return octave_value ();
206}
207
208Matrix
210{
212
213 if (! in_class_method (cls) && ! called_from_builtin ())
214 {
215 octave::cdef_method meth = cls.find_method ("size");
216
217 if (meth.ok ())
218 {
219 count++;
220 octave_value_list args (1, octave_value (this));
221
222 octave_value_list lv = meth.execute (args, 1, true, "size");
223 if (lv.length () <= 0
224 || ! lv(0).is_matrix_type () || ! lv(0).dims ().isvector ())
225 error ("%s.size: invalid return value", class_name ().c_str ());
226
227 return lv(0).matrix_value ();
228 }
229 }
230
231 return octave_base_value::size ();
232}
233
236{
237 octave_idx_type retval = -1;
238
240
241 if (! in_class_method (cls) && ! called_from_builtin ())
242 {
243 octave::cdef_method meth = cls.find_method ("numel");
244
245 if (meth.ok ())
246 {
247 octave_value_list args (idx.length () + 1, octave_value ());
248
249 count++;
250 args(0) = octave_value (this);
251
252 for (octave_idx_type i = 0; i < idx.length (); i++)
253 args(i+1) = idx(i);
254
255 // Temporarily set lvalue list of current statement to NULL, to avoid
256 // using that list for the execution of the method "numel"
257 octave::interpreter& interp = octave::__get_interpreter__ ("octave_classdef::xnumel");
258 octave::tree_evaluator& tw = interp.get_evaluator();
259
260 octave::unwind_action act ([&tw] (const std::list<octave::octave_lvalue> *lvl)
261 {
262 tw.set_lvalue_list (lvl);
263 }, tw.lvalue_list ());
264 tw.set_lvalue_list (nullptr);
265
266 octave_value_list lv = meth.execute (args, 1, true, "numel");
267 if (lv.length () != 1 || ! lv(0).is_scalar_type ())
268 error ("@%s/numel: invalid return value", cls.get_name ().c_str ());
269
270 retval = lv(0).idx_type_value (true);
271
272 return retval;
273 }
274 }
275
276 retval = octave_base_value::xnumel (idx);
277
278 return retval;
279}
280
281void
282octave_classdef::print (std::ostream& os, bool)
283{
284 print_raw (os);
285}
286
287void
288octave_classdef::print_raw (std::ostream& os, bool) const
289{
291
292 if (cls.ok ())
293 {
294 bool is_array = m_object.is_array ();
295
297
298 indent (os);
299 os << class_name () << " object";
300 if (is_array)
301 os << " array";
302 os << " with properties:";
303 newline (os);
304 if (! Vcompact_format)
305 newline (os);
306
308
309 std::map<std::string, octave::cdef_property> property_map
310 = cls.get_property_map ();
311
312 std::size_t max_len = 0;
313 for (const auto& pname_prop : property_map)
314 {
315 // FIXME: this loop duplicates a significant portion of the
316 // loop below and the loop in Fproperties.
317
318 const octave::cdef_property& prop = pname_prop.second;
319
320 const std::string nm = prop.get_name ();
321
322 octave_value acc = prop.get ("GetAccess");
323
324 if (! acc.is_string () || acc.string_value () != "public")
325 continue;
326
327 octave_value hid = prop.get ("Hidden");
328
329 if (hid.bool_value ())
330 continue;
331
332 std::size_t sz = nm.size ();
333
334 if (sz > max_len)
335 max_len = sz;
336 }
337
338 for (auto& pname_prop : property_map)
339 {
340 const octave::cdef_property& prop = pname_prop.second;
341
342 const std::string nm = prop.get_name ();
343
344 octave_value acc = prop.get ("GetAccess");
345
346 if (! acc.is_string () || acc.string_value () != "public")
347 continue;
348
349 octave_value hid = prop.get ("Hidden");
350
351 if (hid.bool_value ())
352 continue;
353
354 indent (os);
355
356 if (is_array)
357 os << " " << nm;
358 else
359 {
360 octave_value val = prop.get_value (m_object, false);
361 dim_vector dims = val.dims ();
362
363 os << std::setw (max_len+2) << nm << ": ";
364 if (val.is_string ())
365 os << val.string_value ();
366 else if (val.islogical ())
367 os << val.bool_value ();
368 else
369 os << "[" << dims.str () << " " << val.class_name () << "]";
370 }
371
372 newline (os);
373 }
374
377 }
378}
379
380bool
381octave_classdef::is_instance_of (const std::string& cls_name) const
382{
383 octave::cdef_class cls = octave::lookup_class (cls_name, false, false);
384
385 if (cls.ok ())
386 return is_superclass (cls, m_object.get_class ());
387
388 return false;
389}
390
392octave_classdef::superclass_ref (const std::string& meth,
393 const std::string& cls)
394{
395 return octave_value (new octave_classdef_superclass_ref (meth, cls));
396}
397
399octave_classdef::metaclass_query (const std::string& cls)
400{
401 return octave::to_ov (octave::lookup_class (cls));
402}
403
404bool octave_classdef_meta::is_classdef_method (const std::string& cname) const
405{
406 bool retval = false;
407
408 if (m_object.is_method ())
409 {
410 if (cname.empty ())
411 retval = true;
412 else
413 {
415
416 return meth.is_defined_in_class (cname);
417 }
418 }
419
420 return retval;
421}
422
423bool octave_classdef_meta::is_classdef_constructor (const std::string& cname) const
424{
425 bool retval = false;
426
427 if (m_object.is_class ())
428 {
429 if (cname.empty ())
430 retval = true;
431 else
432 {
434
435 if (cls.get_name () == cname)
436 retval = true;
437 }
438 }
439
440 return retval;
441}
442
443std::string octave_classdef_meta::doc_string (const std::string& meth_name) const
444{
445 if (m_object.is_class ())
446 {
448
449 if (meth_name.empty ())
450 return cls.doc_string ();
451
452 octave::cdef_method cdef_meth = cls.find_method (meth_name);
453
454 if (cdef_meth.ok ())
455 return cdef_meth.get_doc_string ();
456 }
457
458 return "";
459}
460
461std::string octave_classdef_meta::file_name (void) const
462{
463 if (m_object.is_class ())
464 {
466
467 return cls.file_name ();
468 }
469
470 return "";
471}
472
474octave_classdef_superclass_ref::execute (octave::tree_evaluator& tw,
475 int nargout,
476 const octave_value_list& idx)
477{
478 octave_value_list retval;
479
480 std::string meth_name;
481 bool in_constructor;
483
484 ctx = octave::get_class_context (meth_name, in_constructor);
485
486 if (! ctx.ok ())
487 error ("superclass calls can only occur in methods or constructors");
488
489 std::string mname = m_method_name;
490 std::string cname = m_class_name;
491
492 // CLS is the superclass. The lookup_class function handles
493 // pkg.class names.
494
496
497 if (in_constructor)
498 {
499 if (! is_direct_superclass (cls, ctx))
500 error ("'%s' is not a direct superclass of '%s'",
501 cname.c_str (), ctx.get_name ().c_str ());
502
503 if (! is_constructed_object (tw, mname))
504 error ("cannot call superclass constructor with variable '%s'",
505 mname.c_str ());
506
507 octave_value sym = tw.varval (mname);
508
509 cls.run_constructor (octave::to_cdef_ref (sym), idx);
510
511 retval(0) = sym;
512 }
513 else
514 {
515 std::size_t pos = mname.find ('.');
516
518
519 if (pos != std::string::npos)
520 {
521 // We are looking at obj.meth.
522
523 std::string oname = m_method_name.substr (0, pos);
524 mname = mname.substr (pos + 1);
525
526 octave_value tval = tw.varval (oname);
527
528 // FIXME: Can we only call superclass methods on the current
529 // object? If so, and we are looking at something like
530 //
531 // function meth (obj, ...)
532 // obj.meth@superclass (...)
533 //
534 // Do we need to verify that the object that was passed to
535 // meth is the same as the object we find when looking up
536 // obj in the expression obj.meth? If so, what is the right
537 // way to perform that check?
538
539 if (tval.is_classdef_object ())
540 {
541 octave_classdef *cdobj = tval.classdef_object_value ();
542
543 obj = cdobj->get_object ();
544 }
545 }
546
547 if (mname != meth_name)
548 error ("method name mismatch ('%s' != '%s')",
549 mname.c_str (), meth_name.c_str ());
550
551 if (! is_strict_superclass (cls, ctx))
552 error ("'%s' is not a superclass of '%s'",
553 cname.c_str (), ctx.get_name ().c_str ());
554
555 // I see 2 possible implementations here:
556 // 1) use cdef_object::subsref with a different class
557 // context; this avoids duplicating code, but
558 // assumes the object is always the first argument
559 // 2) lookup the method manually and call
560 // cdef_method::execute; this duplicates part of
561 // logic in cdef_object::subsref, but avoid the
562 // assumption of 1)
563 // Not being sure about the assumption of 1), I
564 // go with option 2) for the time being.
565
566 octave::cdef_method meth = cls.find_method (meth_name, false);
567
568 if (! meth.ok ())
569 error ("no method '%s' found in superclass '%s'",
570 meth_name.c_str (), cname.c_str ());
571
572 retval = (obj.ok ()
573 ? meth.execute (obj, idx, nargout, true, meth_name)
574 : meth.execute (idx, nargout, true, meth_name));
575 }
576
577 return retval;
578}
579
581 const std::string& nm)
582{
583 octave_function *of = tw.current_function ();
584
585 if (of->is_classdef_constructor ())
586 {
588
589 if (uf)
590 {
591 octave::tree_parameter_list *ret_list = uf->return_list ();
592
593 if (ret_list && ret_list->length () == 1)
594 return (ret_list->front ()->name () == nm);
595 }
596 }
597
598 return false;
599}
600
601OCTAVE_NAMESPACE_BEGIN
602
603DEFUN (__meta_get_package__, args, ,
604 doc: /* -*- texinfo -*-
605@deftypefn {} {} __meta_get_package__ ()
606Undocumented internal function.
607@end deftypefn */)
608{
609 if (args.length () != 1)
610 print_usage ();
611
612 std::string cname = args(0).xstring_value ("PACKAGE_NAME must be a string");
613
614 return to_ov (lookup_package (cname));
615}
616
617DEFUN (metaclass, args, ,
618 doc: /* -*- texinfo -*-
619@deftypefn {} {} metaclass (obj)
620Returns the meta.class object corresponding to the class of @var{obj}.
621@end deftypefn */)
622{
623 if (args.length () != 1)
624 print_usage ();
625
626 cdef_object obj = to_cdef (args(0));
627
628 return to_ov (obj.get_class ());
629}
630
631// FIXME: What about dynamic properties if obj is a scalar, or the
632// properties of the class of obj if obj is an array? Probably there
633// should be a function to do this job so that the DEFUN is just a
634// simple wrapper.
635
636DEFUN (properties, args, nargout,
637 doc: /* -*- texinfo -*-
638@deftypefn {} {} properties (@var{class_name})
639@deftypefnx {} {} properties (@var{obj})
640@deftypefnx {} {@var{plist} =} properties (@dots{})
641Return or display the public properties for the named class
642@var{class_name} or classdef object @var{obj}.
643
644If an output value is requested, return the list of property names in a
645cell array.
646
647Programming Note: Property names are returned if the @code{GetAccess}
648attribute is public and if the @code{Hidden} attribute is false.
649@seealso{methods}
650@end deftypefn */)
651{
652 if (args.length () != 1)
653 print_usage ();
654
655 octave_value arg = args(0);
656
657 std::string class_name;
658
659 if (arg.isobject ())
660 class_name = arg.class_name ();
661 else if (arg.is_string ())
662 class_name = arg.string_value ();
663 else
664 err_wrong_type_arg ("properties", arg);
665
666 cdef_class cls;
667
668 cls = lookup_class (class_name, false, true);
669
670 if (! cls.ok ())
671 error ("invalid class: %s", class_name.c_str ());
672
673 std::map<std::string, cdef_property> property_map =
674 cls.get_property_map ();
675
676 std::list<std::string> property_names;
677
678 for (const auto& pname_prop : property_map)
679 {
680 // FIXME: this loop duplicates a significant portion of the loops
681 // in octave_classdef::print_raw.
682
683 const cdef_property& prop = pname_prop.second;
684
685 std::string nm = prop.get_name ();
686
687 octave_value acc = prop.get ("GetAccess");
688
689 if (! acc.is_string () || acc.string_value () != "public")
690 continue;
691
692 octave_value hid = prop.get ("Hidden");
693
694 if (hid.bool_value ())
695 continue;
696
697 property_names.push_back (nm);
698 }
699
700 if (nargout > 0)
701 return octave_value (Cell (string_vector (property_names)));
702
703 octave_stdout << "properties for class " << class_name << ":\n\n";
704
705 for (const auto& nm : property_names)
706 octave_stdout << " " << nm << "\n";
707
708 octave_stdout << std::endl;
709
710 return octave_value ();
711}
712
713/*
714%!assert (properties ("inputParser"),
715%! {"CaseSensitive"; "FunctionName"; "KeepUnmatched";
716%! "Parameters"; "PartialMatching"; "Results";
717%! "StructExpand"; "Unmatched"; "UsingDefaults"});
718*/
719
720// FIXME: Need to implement the -full option.
721
722DEFMETHOD (__methods__, interp, args, ,
723 doc: /* -*- texinfo -*-
724@deftypefn {} {} __methods__ (@var{x})
725@deftypefnx {} {} __methods__ ("classname")
726Internal function.
727
728Implements @code{methods} for Octave class objects and classnames.
729@seealso{methods}
730@end deftypefn */)
731{
732 // Input validation has already been done in methods.m.
733 octave_value arg = args(0);
734
735 std::string class_name;
736
737 if (arg.isobject ())
738 class_name = arg.class_name ();
739 else if (arg.is_string ())
740 class_name = arg.string_value ();
741 else
742 err_wrong_type_arg ("__methods__", arg);
743
744 string_vector sv;
745
746 cdef_class cls = lookup_class (class_name, false, true);
747
748 if (cls.ok ())
749 {
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
765 // The following will also find methods for legacy @CLASS objects.
766
767 load_path& lp = interp.get_load_path ();
768
769 sv.append (lp.methods (class_name));
770
771 return ovl (Cell (sv));
772}
773
774OCTAVE_NAMESPACE_END
775
776/*
777;;; Local Variables: ***
778;;; mode: C++ ***
779;;; End: ***
780*/
bool isvector(const dim_vector &dim)
Definition: Array-util.cc:140
Definition: Cell.h:43
Definition: dMatrix.h:42
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
elt_type & front(void)
Definition: base-list.h:79
std::size_t length(void) const
Definition: base-list.h:53
std::map< std::string, cdef_property > get_property_map(int mode=property_normal)
Definition: cdef-class.h:300
void doc_string(const std::string &txt)
Definition: cdef-class.h:400
OCTINTERP_API cdef_method find_method(const std::string &nm, bool local=false)
Definition: cdef-class.h:459
void file_name(const std::string &nm)
Definition: cdef-class.h:404
std::string get_name(void) const
Definition: cdef-class.h:321
void run_constructor(cdef_object &obj, const octave_value_list &args)
Definition: cdef-class.h:381
bool is_class(void) const
Definition: cdef-object.h:678
bool is_method(void) const
Definition: cdef-object.h:682
bool is_defined_in_class(const std::string &cname) const
Definition: cdef-method.h:206
octave_value_list execute(const octave_value_list &args, int nargout, bool do_check_access=true, const std::string &who="")
Definition: cdef-method.h:164
std::string get_doc_string(void)
Definition: cdef-method.h:196
cdef_object make_array(void) const
Definition: cdef-object.h:244
bool ok(void) const
Definition: cdef-object.h:310
octave_value_list subsref(const std::string &type, const std::list< octave_value_list > &idx, int nargout, std::size_t &skip, const cdef_class &context, bool auto_add=false)
Definition: cdef-object.h:289
OCTINTERP_API cdef_class get_class(void) const
Definition: cdef-object.cc:183
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs, int ignore_copies=0)
Definition: cdef-object.h:297
octave_value get(const std::string &pname) const
Definition: cdef-object.h:266
bool is_array(void) const
Definition: cdef-object.h:251
octave_value get_value(const cdef_object &obj, bool do_check_access=true, const std::string &who="") const
std::string get_name(void) const
std::string name(void) const
Definition: pt-decl.h:90
octave::refcount< octave_idx_type > count
Definition: ov-base.h:906
void decrement_indent_level(void) const
Definition: ov-base.h:890
void increment_indent_level(void) const
Definition: ov-base.h:887
OCTINTERP_API void indent(std::ostream &os) const
Definition: ov-base.cc:1364
OCTINTERP_API void newline(std::ostream &os) const
Definition: ov-base.cc:1383
virtual Matrix size(void)
Definition: ov-base.cc:185
virtual bool is_matrix_type(void) const
Definition: ov-base.h:483
virtual bool is_scalar_type(void) const
Definition: ov-base.h:481
virtual octave_idx_type xnumel(const octave_value_list &)
Definition: ov-base.cc:195
virtual octave_user_function * user_function_value(bool silent=false)
Definition: ov-base.cc:944
virtual octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Definition: ov-base.cc:306
static void register_type(void)
Definition: ov-base.cc:99
friend class octave_value
Definition: ov-base.h:256
OCTINTERP_API bool is_classdef_method(const std::string &cname="") const
Definition: ov-classdef.cc:404
octave::cdef_meta_object m_object
Definition: ov-classdef.h:238
OCTINTERP_API bool is_classdef_constructor(const std::string &cname="") const
Definition: ov-classdef.cc:423
OCTINTERP_API std::string doc_string(const std::string &meth_name) const
Definition: ov-classdef.cc:443
OCTINTERP_API std::string file_name(void) const
Definition: ov-classdef.cc:461
OCTINTERP_API bool is_constructed_object(octave::tree_evaluator &tw, const std::string &nm)
Definition: ov-classdef.cc:580
OCTINTERP_API octave_value_list execute(octave::tree_evaluator &tw, int nargout, const octave_value_list &idx)
Definition: ov-classdef.cc:474
OCTINTERP_API void print(std::ostream &os, bool pr_as_read_syntax=false)
Definition: ov-classdef.cc:282
OCTINTERP_API octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Definition: ov-classdef.cc:152
dim_vector dims(void) const
Definition: ov-classdef.h:130
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:209
static const std::string t_name
Definition: ov-classdef.h:166
octave::cdef_object get_object(void) const
Definition: ov-classdef.h:74
OCTINTERP_API bool is_instance_of(const std::string &cls_name) const
Definition: ov-classdef.cc:381
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:192
octave::cdef_object m_object
Definition: ov-classdef.h:162
static OCTINTERP_API octave_value metaclass_query(const std::string &cls)
Definition: ov-classdef.cc:399
OCTINTERP_API octave_idx_type xnumel(const octave_value_list &)
Definition: ov-classdef.cc:235
static OCTINTERP_API octave_value superclass_ref(const std::string &meth, const std::string &cls)
Definition: ov-classdef.cc:392
OCTINTERP_API void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
Definition: ov-classdef.cc:288
static int t_id
Definition: ov-classdef.h:164
std::string class_name(void) const
Definition: ov-classdef.h:153
virtual bool is_classdef_constructor(const std::string &="") const
Definition: ov-fcn.h:126
octave::tree_parameter_list * return_list(void)
Definition: ov-usr-fcn.h:395
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:1451
OCTINTERP_API octave_classdef * classdef_object_value(bool silent=false) const
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
string_vector & append(const std::string &s)
Definition: str-vec.cc:110
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:980
void err_wrong_type_arg(const char *name, const char *s)
Definition: errwarn.cc:166
T::properties & properties(graphics_object obj)
octave_value to_ov(const cdef_object &obj)
Definition: cdef-utils.cc:128
bool is_superclass(const cdef_class &clsa, const cdef_class &clsb, bool allow_equal, int max_depth)
Definition: cdef-utils.cc:200
cdef_class get_class_context(std::string &name, bool &in_constructor)
Definition: cdef-utils.cc:247
class OCTINTERP_API cdef_class
Definition: cdef-fwd.h:33
class OCTINTERP_API cdef_object
Definition: cdef-fwd.h:34
cdef_object & to_cdef_ref(const octave_value &val)
Definition: cdef-utils.cc:152
cdef_object to_cdef(const octave_value &val)
Definition: cdef-utils.cc:143
cdef_class lookup_class(const std::string &name, bool error_if_not_found, bool load_if_not_found)
Definition: cdef-utils.cc:80
bool is_direct_superclass(const cdef_class &clsa, const cdef_class &clsb)
Definition: cdef-utils.cc:232
interpreter & __get_interpreter__(const std::string &who)
bool is_strict_superclass(const cdef_class &clsa, const cdef_class &clsb)
Definition: cdef-utils.cc:226
cdef_package lookup_package(const std::string &name, bool error_if_not_found, bool load_if_not_found)
Definition: cdef-utils.cc:238
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:1456
bool called_from_builtin(void)
Definition: ov-base.cc:1519
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