Mercurial > hg > octave-nkf
diff libinterp/octave-value/ov-classdef.cc @ 15897:a413c6fe1726 classdef
Add metaclass function.
* libinterp/octave-value/ov-classdef.cc (Fmetaclass): New function.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Fri, 04 Jan 2013 14:29:13 -0500 |
parents | 57be060d7672 |
children | b8bff84022d6 |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-classdef.cc +++ b/libinterp/octave-value/ov-classdef.cc @@ -2601,6 +2601,29 @@ return retval; } +DEFUN (metaclass, args, /* nargout */, + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {} metaclass (obj)\n\ +Returns the meta.class object corresponding to the class of @var{obj}.\n\ +@end deftypefn") +{ + octave_value retval; + + if (args.length () == 1) + { + cdef_object obj = to_cdef (args(0)); + + if (! error_state) + retval = to_ov (obj.get_class ()); + else + print_usage (); + } + else + print_usage (); + + return retval; +} + /* ;;; Local Variables: *** ;;; mode: C++ ***