26 #if defined (HAVE_CONFIG_H)
65 if (stack_fcn && stack_fcn == method_fcn)
85 if (pl && pl->
size () > 0)
95 return obj.
is (arg0_obj);
105 cdef_property::cdef_property_rep::get_value (
const cdef_object& obj,
106 bool do_check_access,
107 const std::string& who)
const
111 if (do_check_access && ! check_get_access ())
112 err_property_access (who,
false);
119 error (
"cannot reference properties of class '%s' for non-constructed object",
120 cls.get_name ().c_str ());
127 if (get_fcn.
isempty () || is_method_executing (get_fcn, obj))
128 retval = obj.
get (get (
"Name").string_value ());
133 args(0) =
to_ov (obj);
137 args = interp.
feval (get_fcn, args, 1);
146 cdef_property::cdef_property_rep::get_value (
bool do_check_access,
147 const std::string& who)
const
149 if (do_check_access && ! check_get_access ())
150 err_property_access (who,
false);
152 return get (
"DefaultValue");
156 cdef_property::cdef_property_rep::is_recursive_set (
const cdef_object& )
const
163 cdef_property::cdef_property_rep::err_property_access
164 (
const std::string& from,
bool is_set)
const
166 octave_value acc = get (is_set ?
"SetAccess" :
"GetAccess");
172 acc_s =
"class-restricted";
175 error (
"%s: property '%s' has %s access and cannot be set in this context",
176 from.c_str (), get_name ().c_str (), acc_s.c_str ());
178 error (
"%s: property '%s' has %s access and cannot be obtained in this context",
179 from.c_str (), get_name ().c_str (), acc_s.c_str ());
183 cdef_property::cdef_property_rep::set_value (
cdef_object& obj,
185 bool do_check_access,
186 const std::string& who)
188 if (do_check_access && ! check_set_access ())
189 err_property_access (who,
true);
196 error (
"cannot reference properties of class '%s' for non-constructed object",
197 cls.get_name ().c_str ());
202 if (set_fcn.
isempty () || is_method_executing (set_fcn, obj))
203 obj.
put (get (
"Name").string_value (), val);
208 args(0) =
to_ov (obj);
214 interp.
feval (set_fcn, args, 0);
217 args = interp.
feval (set_fcn, args, 1);
219 if (args.
length () > 0 && args(0).is_defined ())
221 if (args(0).is_classdef_object ())
228 ::warning (
"set-method of property '%s' returned a non-classdef object",
229 get_name ().c_str ());
236 cdef_property::cdef_property_rep::check_get_access ()
const
240 return check_access (cls, get (
"GetAccess"),
"", get_name (),
false);
246 cdef_property::cdef_property_rep::check_set_access ()
const
250 return check_access (cls, get (
"SetAccess"),
"", get_name (),
true);
255 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_object to_cdef(const octave_value &val)
octave_value to_ov(const cdef_object &obj)
bool is_constructed() const
bool is_partially_constructed_for(const cdef_class &cls) const
bool is_handle_object() const
void put(const std::string &pname, const octave_value &val)
bool is(const cdef_object &obj) const
octave_value get(const std::string &pname) const
octave_value_list feval(const char *name, const octave_value_list &args=octave_value_list(), int nargout=0)
Evaluate an Octave function (built-in or interpreted) and return the list of result values.
virtual octave_user_function * user_function_value(bool silent=false)
bool is_classdef_constructor(const std::string &cname="") const
octave::tree_parameter_list * parameter_list()
octave::tree_parameter_list * return_list()
octave_idx_type length() const
octave_function * function_value(bool silent=false) const
std::string string_value(bool force=false) const
std::string type_name() const
octave_value evaluate(tree_decl_elt *)
octave_function * current_function(bool skip_first=false) const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
void warning(const char *fmt,...)
void() error(const char *fmt,...)
interpreter & __get_interpreter__()
tree_evaluator & __get_evaluator__()