26 #if defined (HAVE_CONFIG_H)
73 const std::list<octave_value_list>& idx,
104 if (
type.length () > skip && idx.size () > skip)
112 const std::list<octave_value_list>& idx,
145 if (
type.length () > skip && idx.size () > skip)
153 const std::list<octave_value_list>& idx,
176 retlist = meth.
execute (args, 1,
true,
"subsasgn");
178 if (retlist.
empty ())
179 error (
"overloaded method 'subsasgn' did not return any value");
185 if (!
retval.is_defined ())
193 const std::list<octave_value_list>& idx,
196 if (
type.length () == 1 &&
type[0] ==
'(')
198 object =
object.make_array ();
227 return lv(0).matrix_value ();
268 error (
"@%s/numel: invalid return value", cls.
get_name ().c_str ());
270 retval = lv(0).idx_type_value (
true);
302 os <<
" with properties:";
309 std::map<std::string, octave::cdef_property> property_map
313 for (
const auto& pname_prop : property_map)
320 const std::string nm = prop.
get_name ();
332 size_t sz = nm.
size ();
338 for (
auto& pname_prop : property_map)
342 const std::string nm = prop.
get_name ();
363 os << std::setw (max_len+2) << nm <<
": ";
393 const std::string& cls)
408 if (
object.is_method ())
427 if (
object.is_class ())
445 if (
object.is_class ())
449 if (meth_name.empty ())
468 std::string meth_name;
475 error (
"superclass calls can only occur in methods or constructors");
488 error (
"'%s' is not a direct superclass of '%s'",
489 cname.c_str (), ctx.
get_name ().c_str ());
492 error (
"cannot call superclass constructor with variable '%s'",
503 size_t pos = mname.find (
'.');
507 if (pos != std::string::npos)
512 mname = mname.substr (pos + 1);
535 if (mname != meth_name)
536 error (
"method name mismatch ('%s' != '%s')",
537 mname.c_str (), meth_name.c_str ());
540 error (
"'%s' is not a superclass of '%s'",
541 cname.c_str (), ctx.
get_name ().c_str ());
557 error (
"no method '%s' found in superclass '%s'",
558 meth_name.c_str (), cname.c_str ());
561 ? meth.
execute (obj, idx, nargout,
true, meth_name)
562 : meth.
execute (idx, nargout,
true, meth_name));
569 const std::string& nm)
581 if (ret_list && ret_list->
length () == 1)
582 return (ret_list->
front ()->
name () == nm);
589 DEFUN (__meta_get_package__, args, ,
595 if (args.length () != 1)
598 std::string cname = args(0).xstring_value (
"PACKAGE_NAME must be a string");
603 DEFUN (metaclass, args, ,
609 if (args.length () != 1)
638 if (args.length () != 1)
643 std::string class_name;
657 error (
"invalid class: %s", class_name.c_str ());
659 std::map<std::string, octave::cdef_property> property_map =
662 std::list<std::string> property_names;
664 for (
const auto& pname_prop : property_map)
683 property_names.push_back (nm);
689 octave_stdout <<
"properties for class " << class_name <<
":\n\n";
691 for (
const auto& nm : property_names)
721 std::string class_name;
736 std::map<std::string, octave::cdef_method> method_map
739 std::list<std::string> method_names;
741 for (
const auto& nm_mthd : method_map)
743 std::string nm = nm_mthd.first;
745 method_names.push_back (nm);
bool isvector(const dim_vector &dim)
Vector representing the dimensions (size) of an Array.
std::string str(char sep='x') const
size_t length(void) const
void doc_string(const std::string &txt)
cdef_method find_method(const std::string &nm, bool local=false)
std::map< std::string, cdef_method > get_method_map(bool only_inherited=false, bool include_ctor=false)
std::map< std::string, cdef_property > get_property_map(int mode=property_normal)
std::string get_name(void) const
void run_constructor(cdef_object &obj, const octave_value_list &args)
bool is_defined_in_class(const std::string &cname) const
octave_value_list execute(const octave_value_list &args, int nargout, bool do_check_access=true, const std::string &who="")
std::string get_doc_string(void)
cdef_class get_class(void) const
octave_value get(const std::string &pname) const
bool is_array(void) const
octave_value get_value(const cdef_object &obj, bool do_check_access=true, const std::string &who="") const
std::string get_name(void) const
tree_evaluator & get_evaluator(void)
std::list< std::string > methods(const std::string &class_name, const std::string &pack_name="")
std::string name(void) const
octave_value varval(const symbol_record &sym) const
void set_lvalue_list(const std::list< octave_lvalue > *lst)
const std::list< octave_lvalue > * lvalue_list(void) const
octave_function * current_function(bool skip_first=false) const
int register_type(const std::string &, const std::string &, const octave_value &, bool abort_on_duplicate=false)
octave::refcount< octave_idx_type > count
void decrement_indent_level(void) const
void increment_indent_level(void) const
void indent(std::ostream &os) const
void newline(std::ostream &os) const
virtual Matrix size(void)
virtual bool is_matrix_type(void) const
virtual bool is_scalar_type(void) const
virtual octave_idx_type xnumel(const octave_value_list &)
virtual octave_user_function * user_function_value(bool silent=false)
virtual octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
static void register_type(void)
friend class octave_value
std::string m_method_name
bool is_constructed_object(octave::tree_evaluator &tw, const std::string &nm)
octave_value_list execute(octave::tree_evaluator &tw, int nargout, const octave_value_list &idx)
void print(std::ostream &os, bool pr_as_read_syntax=false)
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
dim_vector dims(void) const
octave_value_list subsref(const std::string &type, const std::list< octave_value_list > &idx, int nargout)
static const std::string t_name
octave::cdef_object get_object(void) const
bool is_instance_of(const std::string &cls_name) const
octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
static octave_value metaclass_query(const std::string &cls)
octave_idx_type xnumel(const octave_value_list &)
static octave_value superclass_ref(const std::string &meth, const std::string &cls)
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
std::string class_name(void) const
virtual bool is_classdef_constructor(const std::string &="") const
octave::tree_parameter_list * return_list(void)
octave_idx_type length(void) const
bool is_classdef_object(void) const
bool bool_value(bool warn=false) const
bool is_string(void) const
std::string class_name(void) const
std::string string_value(bool force=false) const
octave_classdef * classdef_object_value(bool silent=false) const
bool isobject(void) const
bool islogical(void) const
dim_vector dims(void) const
string_vector & append(const std::string &s)
OCTINTERP_API void print_usage(void)
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void error(const char *fmt,...)
void err_wrong_type_arg(const char *name, const char *s)
T::properties & properties(graphics_object obj)
bool is_superclass(const cdef_class &clsa, const cdef_class &clsb, bool allow_equal, int max_depth)
octave_value to_ov(const cdef_object &obj)
bool is_direct_superclass(const cdef_class &clsa, const cdef_class &clsb)
cdef_object to_cdef(const octave_value &val)
interpreter & __get_interpreter__(const std::string &who)
cdef_class get_class_context(std::string &name, bool &in_constructor)
cdef_package lookup_package(const std::string &name, bool error_if_not_found, bool load_if_not_found)
cdef_class lookup_class(const std::string &name, bool error_if_not_found, bool load_if_not_found)
cdef_object & to_cdef_ref(const octave_value &val)
bool is_strict_superclass(const cdef_class &clsa, const cdef_class &clsb)
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)
bool called_from_builtin(void)
static bool in_class_method(const octave::cdef_class &cls)
octave_value::octave_value(const Array< char > &chm, char type) return retval
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.