26 #if defined (HAVE_CONFIG_H)
54 OCTAVE_NORETURN
static
64 acc_s =
"class-restricted";
66 error (
"%s: method '%s' has %s access and cannot be run in this context",
67 from.c_str (), meth.
get_name ().c_str (), acc_s.c_str ());
81 std::string pack_name;
83 std::size_t pos = cls_name.rfind (
'.');
85 if (pos != std::string::npos)
87 pack_name = cls_name.substr (0, pos);
88 cls_name = cls_name.substr (pos + 1);
92 std::string file_name = lp.
find_method (cls_name, name,
95 if (! file_name.empty ())
115 error (
"no definition found for method '%s' of class '%s'",
122 int nargout,
bool do_check_access,
123 const std::string& who)
130 if (
get (
"Abstract").bool_value ())
131 error (
"%s: cannot execute abstract method",
132 get (
"Name").string_value ().c_str ());
136 if (m_function.is_defined ())
137 retval =
feval (m_function, args, nargout);
145 int nargout,
bool do_check_access,
146 const std::string& who)
153 if (
get (
"Abstract").bool_value ())
154 error (
"%s: cannot execute abstract method",
155 get (
"Name").string_value ().c_str ());
159 if (m_function.is_defined ())
165 new_args(0) =
to_ov (obj);
166 for (
int i = 0; i < args.
length (); i++)
167 new_args(i+1) = args(i);
169 retval =
feval (m_function, new_args, nargout);
178 if (m_function.is_function())
179 return m_function.function_value ()->is_classdef_constructor ();
187 return (m_function.is_function ()
188 ? m_function.function_value ()->dispatch_class () == cname
212 (
const std::string& type,
const std::list<octave_value_list>& idx,
220 retval = (
execute (idx.front (),
221 type.length () > 1 ? 1 : nargout,
true));
225 error (
"invalid meta.method indexing");
229 if (type.length () > 1 && idx.size () > 1 && ! retval.
empty ())
230 retval = retval(0).next_subsref (nargout, type, idx, 1);
static OCTAVE_NORETURN void err_method_access(const std::string &from, const cdef_method &meth)
bool check_access(const cdef_class &cls, const octave_value &acc, const std::string &meth_name, const std::string &prop_name, bool is_prop_set)
bool is_dummy_method(const octave_value &fcn)
cdef_object to_cdef(const octave_value &val)
octave_value to_ov(const cdef_object &obj)
void make_function_of_class(const std::string &class_name, const octave_value &fcn)
OCTINTERP_API bool check_access(void) const
OCTINTERP_API bool is_constructor(void) const
OCTINTERP_API std::string get_doc_string(void)
OCTINTERP_API void check_method(void)
OCTINTERP_API octave_value_list execute(const octave_value_list &args, int nargout, bool do_check_access=true, const std::string &who="")
octave_value_list meta_subsref(const std::string &type, const std::list< octave_value_list > &idx, int nargout)
bool is_external(void) const
std::string m_dispatch_type
std::string get_name(void) const
OCTINTERP_API 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="")
bool check_access(void) const
std::string get_name(void) const
octave_value get(const std::string &pname) const
std::string find_method(const std::string &class_name, const std::string &meth, std::string &dir_name, const std::string &pack_name="")
virtual octave_function * function_value(bool silent=false)
virtual std::string doc_string(const std::string &="") const
void resize(octave_idx_type n, const octave_value &rfv=octave_value())
octave_idx_type length(void) const
bool is_string(void) const
bool is_defined(void) const
std::string string_value(bool force=false) const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
void error(const char *fmt,...)
load_path & __get_load_path__(void)
octave_value load_fcn_from_file(const std::string &file_name, const std::string &dir_name, const std::string &dispatch_type, const std::string &package_name, const std::string &fcn_name, bool autoload)
octave_value_list feval(const char *name, const octave_value_list &args, int nargout)
Evaluate an Octave function (built-in or interpreted) and return the list of result values.