Mercurial > octave-dspies
changeset 15955:837a4a9b5049 classdef
Support constructor call with no indexing syntax.
* libinterp/octave-value/ov-classdef.cc
(octave_classdef_proxy::do_multi_index_op): Emulate constructor.
(octave_classdef_proxy::is_postfix_index_handled): New method, support '(' and
'.' index.
(octave_classdef_proxy::function_value): New method, return itself.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Tue, 15 Jan 2013 17:01:13 -0500 |
parents | 46ca8488de92 |
children | d8553705f8f0 |
files | libinterp/octave-value/ov-classdef.cc |
diffstat | 1 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-classdef.cc Tue Jan 15 17:01:10 2013 -0500 +++ b/libinterp/octave-value/ov-classdef.cc Tue Jan 15 17:01:13 2013 -0500 @@ -853,6 +853,8 @@ all_classes.erase (klass.get_name ()); } + octave_function* function_value (bool = false) { return this; } + octave_value_list subsref (const std::string& type, const std::list<octave_value_list>& idx, @@ -871,8 +873,18 @@ } octave_value_list - do_multi_index_op (int /* nargout */, const octave_value_list& /* idx */) - { return to_ov (klass); } + do_multi_index_op (int nargout, const octave_value_list& idx) + { + // Emulate constructor + + std::list<octave_value_list> l (1, idx); + std::string type ("("); + + return subsref (type, l, nargout); + } + + bool is_postfix_index_handled (char type) const + { return (type == '(' || type == '.'); } private: cdef_class klass;