26#if ! defined (octave_cdef_method_h)
27#define octave_cdef_method_h 1
29#include "octave-config.h"
56 cdef_method_rep&
operator = (
const cdef_method_rep& m) =
delete;
58 ~cdef_method_rep () =
default;
62 bool is_method ()
const {
return true; }
64 std::string get_name ()
const {
return get(
"Name").string_value (); }
66 void set_name (
const std::string& nm) { put (
"Name", nm); }
68 bool is_static ()
const {
return get(
"Static").bool_value (); }
70 octave_value get_function ()
const {
return m_function; }
72 void set_function (
const octave_value& fcn) { m_function = fcn; }
74 OCTINTERP_API std::string get_doc_string ();
78 bool is_external ()
const {
return ! m_dispatch_type.empty (); }
80 void mark_as_external (
const std::string& dtype)
82 m_dispatch_type = dtype;
87 bool do_check_access =
true,
const std::string& who =
"");
92 bool do_check_access =
true,
const std::string& who =
"");
94 OCTINTERP_API
bool is_constructor ()
const;
96 OCTINTERP_API
bool is_defined_in_class (
const std::string& cname)
const;
99 meta_subsref (
const std::string& type,
100 const std::list<octave_value_list>& idx,
int nargout);
102 bool meta_accepts_postfix_index (
char type)
const
104 return (type ==
'(' || type ==
'.');
109 cdef_method_rep (
const cdef_method_rep& m)
111 m_dispatch_type (m.m_dispatch_type)
114 OCTINTERP_API
void check_method ();
127 std::string m_dispatch_type;
137 get_rep ()->set_name (nm);
147 error (
"internal error: invalid assignment from %s to meta.method object",
148 class_name ().c_str ());
162 bool do_check_access =
true,
163 const std::string& who =
"")
165 return get_rep ()->execute (args, nargout, do_check_access, who);
171 bool do_check_access =
true,
172 const std::string& who =
"")
174 return get_rep ()->execute (obj, args, nargout, do_check_access, who);
179 std::string
get_name ()
const {
return get_rep ()->get_name (); }
181 bool is_static ()
const {
return get_rep ()->is_static (); }
185 get_rep ()->set_function (fcn);
190 return get_rep ()->get_function ();
195 return get_rep ()->get_doc_string ();
200 return get_rep ()->is_constructor ();
205 return get_rep ()->is_defined_in_class (cname);
212 get_rep ()->mark_as_external (dtype);
217 cdef_method_rep * get_rep ()
222 const cdef_method_rep * get_rep ()
const
228OCTAVE_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)
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)
cdef_object & operator=(const cdef_object &obj)
const cdef_object_rep * get_rep() const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
void error(const char *fmt,...)