26 #if ! defined (octave_cdef_method_h)
27 #define octave_cdef_method_h 1
29 #include "octave-config.h"
59 cdef_method_rep&
operator = (
const cdef_method_rep&
m) =
delete;
61 ~cdef_method_rep () =
default;
69 void set_name (
const std::string& nm) {
put (
"Name", nm); }
71 bool is_static ()
const {
return get(
"Static").
bool_value (); }
73 octave_value get_function ()
const {
return m_function; }
75 void set_function (
const octave_value& fcn) { m_function = fcn; }
77 OCTINTERP_API std::string get_doc_string ();
81 bool is_external ()
const {
return ! m_dispatch_type.empty (); }
83 void mark_as_external (
const std::string& dtype)
85 m_dispatch_type = dtype;
90 bool do_check_access =
true,
const std::string& who =
"");
95 bool do_check_access =
true,
const std::string& who =
"");
97 OCTINTERP_API
bool is_constructor ()
const;
99 OCTINTERP_API
bool is_defined_in_class (
const std::string& cname)
const;
103 const std::list<octave_value_list>& idx,
int nargout);
107 return (type ==
'(' || type ==
'.');
112 cdef_method_rep (
const cdef_method_rep&
m)
114 m_dispatch_type (
m.m_dispatch_type)
117 OCTINTERP_API
void check_method ();
130 std::string m_dispatch_type;
140 get_rep ()->set_name (nm);
150 error (
"internal error: invalid assignment from %s to meta.method object",
165 bool do_check_access =
true,
166 const std::string& who =
"")
168 return get_rep ()->execute (args, nargout, do_check_access, who);
174 bool do_check_access =
true,
175 const std::string& who =
"")
177 return get_rep ()->execute (obj, args, nargout, do_check_access, who);
182 std::string
get_name ()
const {
return get_rep ()->get_name (); }
184 bool is_static ()
const {
return get_rep ()->is_static (); }
188 get_rep ()->set_function (fcn);
193 return get_rep ()->get_function ();
198 return get_rep ()->get_doc_string ();
203 return get_rep ()->is_constructor ();
208 return get_rep ()->is_defined_in_class (cname);
215 get_rep ()->mark_as_external (dtype);
220 cdef_method_rep * get_rep ()
225 const cdef_method_rep * get_rep ()
const
231 OCTAVE_END_NAMESPACE(
octave)
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)
cdef_class & operator=(const cdef_class &cls)
std::string get_name() const
octave_value_list execute(const cdef_object &obj, const octave_value_list &args, int nargout, bool do_check_access=true, const std::string &who="")
bool is_constructor() const
cdef_method(const std::string &nm)
cdef_method(const cdef_method &meth)
bool check_access() const
octave_value_list execute(const octave_value_list &args, int nargout, bool do_check_access=true, const std::string &who="")
bool is_defined_in_class(const std::string &cname) const
octave_value get_function() const
void set_function(const octave_value &fcn)
std::string get_doc_string()
std::string get_name() const
cdef_method(const cdef_object &obj)
void mark_as_external(const std::string &dtype)
const cdef_object_rep * get_rep() const
cdef_object & operator=(const cdef_object &obj)
void put(const std::string &pname, const octave_value &val)
std::string class_name() const
octave_value get(const std::string &pname) const
bool bool_value(bool warn=false) const
std::string string_value(bool force=false) const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
void() error(const char *fmt,...)